### Question:
LogPrinter { static Map<String, Function<StoredAuditRecord, Object>> getAvailableFieldFunctionMap(EcLogYamlConfig config) { Map<String, Function<StoredAuditRecord, Object>> availableFields = new HashMap<>(); availableFields.put("CLIENT_IP", entry -> entry.getClientAddress().map(InetAddress::getHostAddress).orElse(null)); availableFields.put("CLIENT_PORT", entry -> entry.getClientPort().orElse(null)); availableFields.put("COORDINATOR_IP", entry -> entry.getCoordinatorAddress().map(InetAddress::getHostAddress).orElse(null)); availableFields.put("USER", entry -> entry.getUser().orElse(null)); availableFields.put("BATCH_ID", entry -> entry.getBatchId().orElse(null)); availableFields.put("STATUS", entry -> entry.getStatus().orElse(null)); availableFields.put("OPERATION", entry -> entry.getOperation().orElse(null)); availableFields.put("OPERATION_NAKED", entry -> entry.getNakedOperation().orElse(null)); availableFields.put("TIMESTAMP", entry -> entry.getTimestamp().map(formatTimestamp(config)).orElse(null)); return Collections.unmodifiableMap(availableFields); } LogPrinter(ToolOptions toolOptions);   LogPrinter(ToolOptions toolOptions, PrintStream out, long pollIntervalMs, EcLogYamlConfig config);   }### Answer:
@Test public void testAvailableFieldFunctions() { EcLogYamlConfig configMock = mock(EcLogYamlConfig.class); Map<String, Function<StoredAuditRecord, Object>> availableFieldFunctions = LogPrinter.getAvailableFieldFunctionMap(configMock); StoredAuditRecord emptyRecord = StoredAuditRecord.builder().build(); assertThat(availableFieldFunctions).containsOnlyKeys("CLIENT_IP", "CLIENT_PORT", "COORDINATOR_IP", "USER", "BATCH_ID", "STATUS", "OPERATION", "OPERATION_NAKED", "TIMESTAMP"); assertThat(availableFieldFunctions.get("CLIENT_IP").apply(emptyRecord)).isNull(); assertThat(availableFieldFunctions.get("CLIENT_IP").apply(FULL_RECORD)).isEqualTo("1.2.3.4"); assertThat(availableFieldFunctions.get("CLIENT_PORT").apply(emptyRecord)).isNull(); assertThat(availableFieldFunctions.get("CLIENT_PORT").apply(FULL_RECORD)).isEqualTo(42); assertThat(availableFieldFunctions.get("COORDINATOR_IP").apply(emptyRecord)).isNull(); assertThat(availableFieldFunctions.get("COORDINATOR_IP").apply(FULL_RECORD)).isEqualTo("5.6.7.8"); assertThat(availableFieldFunctions.get("USER").apply(emptyRecord)).isNull(); assertThat(availableFieldFunctions.get("USER").apply(FULL_RECORD)).isEqualTo("king"); assertThat(availableFieldFunctions.get("BATCH_ID").apply(emptyRecord)).isNull(); assertThat(availableFieldFunctions.get("BATCH_ID").apply(FULL_RECORD)).isEqualTo(UUID.fromString("12345678-aaaa-bbbb-cccc-123456789abc")); assertThat(availableFieldFunctions.get("STATUS").apply(emptyRecord)).isNull(); assertThat(availableFieldFunctions.get("STATUS").apply(FULL_RECORD)).isEqualTo(Status.ATTEMPT); assertThat(availableFieldFunctions.get("OPERATION").apply(emptyRecord)).isNull(); assertThat(availableFieldFunctions.get("OPERATION").apply(FULL_RECORD)).isEqualTo("select something"); assertThat(availableFieldFunctions.get("OPERATION_NAKED").apply(emptyRecord)).isNull(); assertThat(availableFieldFunctions.get("OPERATION_NAKED").apply(FULL_RECORD)).isEqualTo("select something - naked"); assertThat(availableFieldFunctions.get("TIMESTAMP").apply(emptyRecord)).isNull(); assertThat(availableFieldFunctions.get("TIMESTAMP").apply(FULL_RECORD)).isEqualTo("123"); }