SQLIndexNameTranslator implements IndexNameTranslator { @Override public String translate(Index<?> index) { if (index == null) { throw new IllegalArgumentException("Class to translate is null"); } return DigestUtils.shaHex(index.getName()).substring(0, DEFAULT_MAXLEN).toUpperCase(); }  @Override String translate(Index<?> index);  }
@Test public void translate_translatesCorrectly() throws Exception { Index<?> index = mock(Index.class); when(index.getName()).thenReturn("The quick brown fox jumps over the lazy dog"); assertEquals("2FD4E1C67A", translator.translate(index)); }
@Test(expected = IllegalArgumentException.class) public void translate_null_throwsException() throws Exception { translator.translate(null); }