SuspensionResultsMapper { public List<String> getSuspendablesNames(final List<SuspensionResult> suspensionResults) { return suspensionResults.stream() .map(SuspensionResult::getSuspendableName) .collect(toList()); }  List<SuspensionResult> getSuccessfulResults(final List<SuspensionResult> suspensionResults); List<SuspensionResult> getFailedResults(final List<SuspensionResult> suspensionResults); List<String> getSuspendablesNames(final List<SuspensionResult> suspensionResults);  }
@Test public void shouldGetAListOfShutteringExecutorNames() throws Exception { final SuspensionResult suspensionResult_1 = mock(SuspensionResult.class); final SuspensionResult suspensionResult_2 = mock(SuspensionResult.class); final SuspensionResult suspensionResult_3 = mock(SuspensionResult.class); final SuspensionResult suspensionResult_4 = mock(SuspensionResult.class); when(suspensionResult_1.getSuspendableName()).thenReturn("Executor name 1"); when(suspensionResult_2.getSuspendableName()).thenReturn("Executor name 2"); when(suspensionResult_3.getSuspendableName()).thenReturn("Executor name 3"); when(suspensionResult_4.getSuspendableName()).thenReturn("Executor name 4"); final List<String> shutteringExecutorNames = suspensionResultsMapper.getSuspendablesNames(asList( suspensionResult_1, suspensionResult_2, suspensionResult_3, suspensionResult_4)); assertThat(shutteringExecutorNames.size(), is(4)); assertThat(shutteringExecutorNames, hasItem("Executor name 1")); assertThat(shutteringExecutorNames, hasItem("Executor name 2")); assertThat(shutteringExecutorNames, hasItem("Executor name 3")); assertThat(shutteringExecutorNames, hasItem("Executor name 4")); }