### Question:
TypeHandler { public @NotNull Object[] instantiateTypes(Class<?>[] classes, List<String> input) throws InputException { return instantiateTypes(classes, input, null); } TypeHandler(Logger logger); @Nullable String getOutputFor(@Nullable Object object); @NotNull Object[] instantiateTypes(Class<?>[] classes, List<String> input); @NotNull Object[] instantiateTypes(Class<?>[] classes, List<String> input, @Nullable PlatformSender<?> sender); boolean registerHandler(Handler handler); @Nullable IHandler getIHandlerForClass(Class<?> clazz); @NotNull Collection<IHandler> getAllInputHandlers(); @NotNull Collection<OHandler> getAllOutputHandlers();  }### Answer:
@Test public void ensurePolymorphicInput() throws InputException { Class[] requestedTypes = {AnEnum.class, AnEnum.class}; String[] inputArgs = {"VAL_1", "VAL_5"}; Object[] output = typeHandler.instantiateTypes(requestedTypes, Arrays.asList(inputArgs)); assertTrue(output[0] instanceof AnEnum); assertTrue(output[1] instanceof AnEnum); Assertions.assertEquals(AnEnum.VAL_1, output[0]); Assertions.assertEquals(AnEnum.VAL_5, output[1]); }
@Test public void ensureThrowsOnNoSuchIHandler() { Assertions.assertThrows(InputException.class, () -> { Class[] requestedType = {CASE_NEVER_WILL_BE_REGISTERED}; typeHandler.instantiateTypes(requestedType, Collections.singletonList("blah")); }); }
@Test public void ensureNullAlwaysAvailable() throws InputException { Object[] array = typeHandler.instantiateTypes(new Class[]{Object.class}, Collections.singletonList(TypeHandler.NULL_INSTANCE_KEYWORD)); Object instance = array[0]; assertNull(instance); }