@Test
public void get_last_snapshot_by_component_uuid() {
setupData("get_last_snapshot_by_component_uuid");
SnapshotDto snapshotDto = dao.getLastSnapshotByResourceUuid("ABCD", session);
assertThat(snapshotDto.getId()).isEqualTo(1);
assertThat(snapshotDto.getPeriodMode(1)).isEqualTo("previous_analysis");
assertThat(snapshotDto.getPeriodModeParameter(1)).isNull();
assertThat(snapshotDto.getPeriodDate(1)).isNull();
assertThat(snapshotDto.getPeriodMode(2)).isEqualTo("days");
assertThat(snapshotDto.getPeriodModeParameter(2)).isEqualTo("30");
assertThat(snapshotDto.getPeriodDate(2)).isEqualTo(DateUtils.parseDate("2011-09-24"));
assertThat(snapshotDto.getPeriodMode(3)).isEqualTo("days");
assertThat(snapshotDto.getPeriodModeParameter(3)).isEqualTo("90");
assertThat(snapshotDto.getPeriodDate(3)).isEqualTo(DateUtils.parseDate("2011-07-26"));
assertThat(snapshotDto.getPeriodMode(4)).isEqualTo("previous_analysis");
assertThat(snapshotDto.getPeriodModeParameter(4)).isNull();
assertThat(snapshotDto.getPeriodDate(4)).isNull();
assertThat(snapshotDto.getPeriodMode(5)).isEqualTo("previous_version");
assertThat(snapshotDto.getPeriodModeParameter(5)).isNull();
assertThat(snapshotDto.getPeriodDate(5)).isNull();
snapshotDto = dao.getLastSnapshotByResourceUuid("EFGH", session);
assertThat(snapshotDto.getId()).isEqualTo(2L);
snapshotDto = dao.getLastSnapshotByResourceUuid("GHIJ", session);
assertThat(snapshotDto.getId()).isEqualTo(3L);
assertThat(dao.getLastSnapshotByResourceUuid("UNKNOWN", session)).isNull();
}