### Question:
GenericFacesConverter extends WebApplicationObjectSupport implements ConditionalGenericConverter { public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) { if (SpringFacesContext.getCurrentInstance() == null) { return false; } if (targetType.getAnnotation(FacesConverterId.class) != null) { return true; } FacesContext facesContext = SpringFacesContext.getCurrentInstance().getFacesContext(); Application application = facesContext.getApplication(); return ((application != null) && (application.createConverter(targetType.getType()) != null)); }  Set<ConvertiblePair> getConvertibleTypes(); boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType); Object convert(final Object source, final TypeDescriptor sourceType, final TypeDescriptor targetType);  }### Answer:
@Test public void shouldNotMatchIfNotSpringFacesContext() throws Exception { SpringFacesContextSetter.setCurrentInstance(null); assertThat(this.converter.matches(this.sourceType, TypeDescriptor.valueOf(Object.class)), is(false)); }
@Test public void shouldMatchIfHasAnnotationOnField() throws Exception { TypeDescriptor targetType = AnnotatedClass.getFieldTypeDescriptor(); assertThat(this.converter.matches(this.sourceType, targetType), is(true)); }
@Test public void shouldMatchIfHasAnnotationOnMethod() throws Exception { TypeDescriptor targetType = AnnotatedClass.getMethodParamTypeDescriptor(); assertThat(this.converter.matches(this.sourceType, targetType), is(true)); }
@Test public void shouldMatchIfConverterExists() throws Exception { TypeDescriptor targetType = TypeDescriptor.valueOf(ClassWithConverter.class); assertThat(this.converter.matches(this.sourceType, targetType), is(true)); }
@Test public void shouldNotMatchIfNoConverterExists() throws Exception { TypeDescriptor targetType = TypeDescriptor.valueOf(ClassWithoutConverter.class); assertThat(this.converter.matches(this.sourceType, targetType), is(false)); }