### Question:
LoggingUtil { public static <E extends Enum<E>> Object[] deriveArguments(List<E> tokens, Function<E, Object> tokenValueFunct) { return tokens.stream() .map(tokenValueFunct) .toArray(Object[]::new); }  static void log(Logger logger, LogLevel level, String message, Object... args); static void log(Logger logger, LogLevel level, Class<E> tokensType, String message, Function<E, Object> tokenValueFunct); static void log(Logger logger, LogLevel level, Class<E> tokensType, String message, Throwable th, Function<E, Object> tokenValueFunct); static Object[] extractArguments(Class<E> tokensType, String message, Function<E, Object> tokenValueFunct); static Object[] extractArguments(Class<E> tokensType, String message, Throwable th, Function<E, Object> tokenValueFunct); static Object[] deriveArguments(List<E> tokens, Function<E, Object> tokenValueFunct); static Object[] deriveArguments(List<E> tokens, Throwable th, Function<E, Object> tokenValueFunct); static List<E> extractTokens(Class<E> tokensType, String message); static String toLogMessage(String message);  }### Answer:
@Test public void testDeriveArguments() { Object[] values = LoggingUtil.deriveArguments(Arrays.asList(TestFields.AAA, TestFields.BBB, TestFields.CCC), VALUES_FUNC); assertThat(values).containsExactly(ARGS); }
@Test public void testDeriveArgumentsWithException() { Exception ex = new IllegalArgumentException(); Object[] values = LoggingUtil.deriveArguments(Arrays.asList(TestFields.AAA, TestFields.BBB, TestFields.CCC), ex, VALUES_FUNC); Object[] expectedArgs = Stream.concat(Arrays.stream(ARGS), Stream.of(ex)).toArray(Object[]::new); assertThat(values).containsExactly(expectedArgs); }