use of com.github.nagyesta.abortmission.core.telemetry.converter.LaunchTelemetryConverter in project abort-mission by nagyesta.
the class DefaultLaunchTelemetryDataSourceTest method testFetchClassStatisticsShouldCallConverterWhenConstructedWithValidData.
@Test
void testFetchClassStatisticsShouldCallConverterWhenConstructedWithValidData() {
// given
final LaunchTelemetryConverter converter = mock(LaunchTelemetryConverter.class);
final Map<String, AbortMissionCommandOps> nameSpaces = spy(new HashMap<>());
final SortedMap<String, ClassTelemetry> classStats = spy(new TreeMap<>());
when(converter.processClassStatistics(same(nameSpaces))).thenReturn(classStats);
final DefaultLaunchTelemetryDataSource underTest = new DefaultLaunchTelemetryDataSource(converter, nameSpaces);
// when
final SortedMap<String, ClassTelemetry> actual = underTest.fetchClassStatistics();
// then
Assertions.assertNotNull(actual);
Assertions.assertSame(classStats, actual);
final InOrder inOrder = inOrder(converter, classStats);
inOrder.verify(converter).processClassStatistics(same(nameSpaces));
inOrder.verifyNoMoreInteractions();
verifyNoInteractions(nameSpaces);
}
use of com.github.nagyesta.abortmission.core.telemetry.converter.LaunchTelemetryConverter in project abort-mission by nagyesta.
the class DefaultLaunchTelemetryTest method testConstructorShouldCallFetchClassStatisticsWhenCalledWithValidData.
@Test
void testConstructorShouldCallFetchClassStatisticsWhenCalledWithValidData() {
// given
final LaunchTelemetryConverter converter = mock(LaunchTelemetryConverter.class);
final Map<String, AbortMissionCommandOps> nameSpaces = spy(new HashMap<>());
final SortedMap<String, ClassTelemetry> classStats = spy(new TreeMap<>());
when(converter.processClassStatistics(same(nameSpaces))).thenReturn(classStats);
final LaunchTelemetryDataSource dataSource = mock(LaunchTelemetryDataSource.class);
when(dataSource.fetchClassStatistics()).thenReturn(classStats);
// when
final DefaultLaunchTelemetry actual = new DefaultLaunchTelemetry(dataSource);
// then
Assertions.assertNotNull(actual);
Assertions.assertSame(classStats, actual.getClasses());
Assertions.assertNotNull(actual.getStats());
final InOrder inOrder = inOrder(dataSource, classStats);
inOrder.verify(dataSource).fetchClassStatistics();
// noinspection ResultOfMethodCallIgnored
inOrder.verify(classStats, times(2)).values();
inOrder.verifyNoMoreInteractions();
verifyNoInteractions(nameSpaces);
}
Aggregations