@Test public void selectByEventUuid_on_empty_table() { assertThat(underTest.selectByEventUuid(dbSession, randomAlphabetic(10))) .isEmpty(); }
@Test public void selectByEventUuid_branchKey_can_be_null() { String eventBase = randomAlphabetic(5); String rowBase = randomAlphabetic(6); String eventUuid = eventBase + "_event_uuid"; EventComponentChangeDto dto = new EventComponentChangeDto() .setCategory(randomChangeCategory()) .setUuid(rowBase + "_uuid") .setEventUuid(eventUuid) .setComponentUuid(rowBase + "_component_uuid") .setComponentKey(rowBase + "_component_key") .setComponentName(rowBase + "_component_name") .setComponentBranchKey(null); EventPurgeData purgeData = new EventPurgeData(eventBase + "_component_uuid", eventBase + "_analysis_uuid"); long now = random.nextLong(); when(system2.now()) .thenReturn(now) .thenThrow(new IllegalStateException("now should not be called twice")); underTest.insert(dbSession, dto, purgeData); assertThat(underTest.selectByEventUuid(dbSession, eventUuid)) .extracting(EventComponentChangeDto::getUuid, EventComponentChangeDto::getComponentBranchKey) .containsOnly(tuple(dto.getUuid(), null)); }
Arrays.stream(event2Dtos).forEach(dto -> underTest.insert(dbSession, dto, doesNotMatter)); assertThat(underTest.selectByEventUuid(dbSession, eventUuid1)) .extracting( EventComponentChangeDto::getUuid, eventUuid1, now + 2)); assertThat(underTest.selectByEventUuid(dbSession, eventUuid2)) .extracting( EventComponentChangeDto::getUuid,
assertThat(underTest.selectByEventUuid(dbSession, uuid)) .isEmpty(); assertThat(underTest.selectByEventUuid(dbSession, eventUuid)) .extracting( EventComponentChangeDto::getUuid,