### Question:
RetryLogBuilder { private String fallbackRole(Retry retry, Class<?> msgHandler) { return Optional.of(retry.role()) .filter(role -> !role.isEmpty()) .orElse(msgHandler.getSimpleName()); } RetryLogBuilder(ForkliftMessage msg, Consumer consumer, List<String> errorList, ForkliftConnectorI connector, Retry retry); Map<String, String> getFields(); boolean logProduced();  }### Answer:
@Test public void testFallbackRole() { final String testId = "test-id"; final String testText = "test-text"; final ForkliftMessage msg = new ForkliftMessage(); msg.setId(testId); msg.setMsg(testText); final List<String> errors = Arrays.asList(); final String testRole = ""; final String testSourceName = "test-queue"; final SourceI testSource = new QueueSource(testSourceName); final RoleInputSource roleSource = new RoleInputSource(testRole); final Consumer consumer = Mockito.mock(Consumer.class); Mockito.when(consumer.getSource()).thenReturn(testSource); Mockito.doReturn(TestHandler.class).when(consumer).getMsgHandler(); Mockito.when(consumer.getRoleSources(RoleInputSource.class)) .thenAnswer(invocation -> Stream.of(roleSource)); final String destinationName = "test-destination"; final ActionSource actionSource = new QueueSource(destinationName); final ForkliftConnectorI connector = Mockito.mock(ForkliftConnectorI.class); Mockito.when(connector.mapSource(roleSource)).thenReturn(actionSource); RetryLogBuilder logBuilder = new RetryLogBuilder(msg, consumer, errors, connector, retry); Map<String, String> fields = logBuilder.getFields(); assertEquals("retry-role", fields.get("role")); logBuilder = new RetryLogBuilder(msg, consumer, errors, connector, noRoleRetry); fields = logBuilder.getFields(); assertEquals("TestHandler", fields.get("role")); }