public static Matcher<ModuleDefinition> module(final String name, final ModuleType type) {
		return new DiagnosingMatcher<ModuleDefinition>() {

			@Override
			public void describeTo(Description description) {
				description.appendText("a module named ").appendValue(name).appendText(" with type ").appendValue(type);
			}

			@Override
			protected boolean matches(Object item, Description mismatchDescription) {
				if (item == null) {
					return false;
				}
				ModuleDefinition def = (ModuleDefinition) item;
				mismatchDescription.appendText("a module named ").appendValue(def.getName())
						.appendText(" with type ").appendValue(def.getType());
				return name.equals(def.getName()) && type == def.getType();
			}
		};
	}
Return a matcher that matches a definition by the given name and type.
spring-xd-dirt/src/test/java/org/springframework/xd/dirt/module/ModuleDefinitionMatchers.java