CaseStatusConverter implements Converter<CaseStatus, String> { @Override public CaseStatus toModelValue(final String status) { if (status == null || status.trim().isEmpty()) { return null; } else { return CaseStatus.valueOf(status); } }  @Override CaseStatus toModelValue(final String status); @Override String toWidgetValue(final CaseStatus status); @Override Class<CaseStatus> getModelType(); @Override Class<String> getComponentType();  }
@Test public void testConvertToModel() { assertNull(converter.toModelValue(null)); assertNull(converter.toModelValue("")); assertNull(converter.toModelValue(" ")); assertEquals(CaseStatus.OPEN, converter.toModelValue("OPEN")); assertEquals(CaseStatus.CANCELLED, converter.toModelValue("CANCELLED")); assertEquals(CaseStatus.CLOSED, converter.toModelValue("CLOSED")); }