### Question:
ForClassFilter { public boolean match(Object object, Class<?> targetClass) { Assert.notNull(targetClass, "TargetClass must not be null"); if (object == null) { return false; } Set<Class<?>> classes = getForClasses(object); boolean isForClass = isAssignableFromAny(targetClass, classes); if (!(object instanceof ConditionalForClass)) { return isForClass; } ConditionalForClass conditionalForClass = (ConditionalForClass) object; if (isForClass || classes.isEmpty()) { return conditionalForClass.isForClass(targetClass); } return false; } ForClassFilter();  ForClassFilter(Class<?> genericType);  ForClassFilter(Class<?> genericType, int parameterIndex);  ForClassFilter(Deducer deducer); Collection<E> apply(Collection<E> collection, Class<?> targetClass); Map<K, V> apply(Map<K, V> map, Class<?> targetClass); Iterator<E> apply(Iterator<E> iterator, final Class<?> targetClass); boolean match(Object object, Class<?> targetClass);  }### Answer:
@Test public void shouldNeedTargetOnBean() throws Exception { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("TargetClass must not be null"); new ForClassFilter().match(new Object(), null); }
@Test @SuppressWarnings("rawtypes") public void shouldUseConditionalForClassInterface() throws Exception { Conditional conditional = new Conditional(); boolean actual = new ForClassFilter().match(conditional, Dog.class); assertThat(actual, is(true)); assertThat(conditional.getTargetClass(), is(equalTo((Class) Dog.class))); }
@Test @SuppressWarnings("rawtypes") public void shouldOnlyUseConditionalForClassInterfaceIfAnnotationMatches() throws Exception { ConditionalForDog conditional = new ConditionalForDog(); boolean actual = new ForClassFilter().match(conditional, Cat.class); assertThat(actual, is(false)); assertThat(conditional.getTargetClass(), is(nullValue())); actual = new ForClassFilter().match(conditional, Dog.class); assertThat(actual, is(true)); assertThat(conditional.getTargetClass(), is(equalTo((Class) Dog.class))); }