ArrayTranslator { public <T> T[] translate(Object[] sourceArray, Class<T> destinationClass, TranslationSource translationSource) { T[] destinationArray = createDestinationArray(destinationClass, sourceArray.length); for (int index = 0; index < sourceArray.length; index++) { destinationArray[index] = translationSource.getTranslation( sourceArray[index], destinationClass); } return destinationArray; } ArrayTranslator(Configuration configuration); T[] translate(Object[] sourceArray, Class<T> destinationClass,
			TranslationSource translationSource); T[] defensiveCopy(T[] value); T[] copyTo(Object[] sourceArray, Class<T> destinationClass);  }
@Test public void testCreatesTranslatedArray() { String[] source = new String[] { "One", "Two" }; Mockito.when(translationSource.getTranslation("One",Integer.class)).thenReturn(1); Mockito.when(translationSource.getTranslation("Two",Integer.class)).thenReturn(2); Integer[] destination = new ArrayTranslator(new Configuration()).translate(source, Integer.class, translationSource); Assert.assertNotNull(destination); Assert.assertEquals( 2, destination.length ); Assert.assertEquals( Integer.valueOf(1), destination[0] ); Assert.assertEquals( Integer.valueOf(2), destination[1] ); }