SQLIndexFieldNameTranslator implements IndexFieldNameTranslator { @Override public String translate(IndexField<?> field) { if (field == null) { throw new IllegalArgumentException("Can not translate null IndexField"); } return field.getName().toUpperCase(); }  @Override String translate(IndexField<?> field);  }
@Test public void translate_returnsCorrectString() throws Exception { IndexField<?> field = mock(IndexField.class); when(field.getName()).thenReturn("someProperty"); assertEquals("SOMEPROPERTY", new SQLIndexFieldNameTranslator().translate(field)); }
@Test(expected = IllegalArgumentException.class) public void translateNull_throwsException() throws Exception { new SQLIndexFieldNameTranslator().translate(null); }