@Test public void lackOfKonvGroupSettings() { settings.shrinkKonvGroupScope(konvGroup); assertFalse(settings.hasKonvGroupSettings()); }
@Test public void expandKonvScope() { settings.expandKonvScope(konv); assertTrue(settings.contains(konv)); }
@Test public void shouldExpandDecreeSequenceGroupScope() { settings.expandDecreeSequenceGroupScope(group); assertTrue(settings.contains(group)); }
@Test public void shrinkKonvScope() { settings.expandKonvScope(konv); settings.shrinkKonvScope(konv); assertFalse(settings.contains(konv)); }
@Test public void shouldShrinkDecreeSequenceGroupScope() { settings.expandDecreeSequenceGroupScope(group); settings.shrinkDecreeSequenceGroupScope(group); assertFalse(settings.contains(group)); }
@Test public void defineTheScopeOfReportInputParams() { List<DecreeSequence> decreeSequences = settings.getDecreeSequences(); List<GeoArea> geoAreas = settings.getGeoAreas(); List<KonvGroup> konvGroups = settings.getKonvGroups(); assertThat(decreeSequences, hasItem(decreeSequence)); assertThat(geoAreas, hasItem(geoArea)); assertThat(konvGroups, hasItem(konvGroup)); }
@Test public void shouldReturnInputKonvGroupListWhenAnEmptyKonvGroupScopeIsFound() { settings.shrinkKonvGroupScope(konvGroup); assertThat(settings.hasKonvGroupSettings(), is(Boolean.FALSE)); final KonvGroup inputKonvGroup = mock(KonvGroup.class); List<KonvGroup> selected = settings.chooseOver(Arrays.asList(inputKonvGroup)); assertThat(selected, hasItems(inputKonvGroup)); assertThat(selected, not(hasItems(konvGroup))); }
@Test public void twoSettingsShouldBeEqualIfTheyShareSameCode() { ReportSettings other = new ReportSettings(settings.getCode()); assertThat(other, is(equalTo(settings))); }
@Test public void shouldReturnNonEmptyKonvGroupScopeWhenChoosingOverAnEmptyListOfInputKonvGroups() { List<KonvGroup> selected = settings.chooseOver(Collections.EMPTY_LIST); assertThat(selected, hasItems(konvGroup)); assertThat(selected.size(), is(1)); }
@Test public void shouldReturnNonEmptyKonvGroupScopeWhenChoosingOverNonEmptyListOfInputKonvGroups() { final KonvGroup inputKonvGroup = mock(KonvGroup.class); List<KonvGroup> selected = settings.chooseOver(Arrays.asList(inputKonvGroup)); assertThat(selected, hasItems(konvGroup)); assertThat(selected, not(hasItems(inputKonvGroup))); }
@Test public void aReportSettingsShouldNotContainAkonvWhenItIsNotPresentInItsKonvsCollection() throws NoSuchFieldException, IllegalArgumentException, IllegalAccessException { Field konvsField = ReportSettings.class.getDeclaredField("konvs"); konvsField.setAccessible(true); final ArrayList<Konv> konvs = new ArrayList<>(); konvsField.set(settings, konvs); assertFalse(settings.contains(konv)); }
@Test public void shrinkReportSettingsScopes() { settings.shrinkDecreeSequenceScope(decreeSequence); settings.shrinkGeoAreaScope(geoArea); settings.shrinkKonvGroupScope(konvGroup); assertThat(settings.getDecreeSequences(), not(hasItem(decreeSequence))); assertThat(settings.getGeoAreas(), not(hasItem(geoArea))); assertThat(settings.getKonvGroups(), not(hasItem(konvGroup))); }
@Test public void hasKonvGroupSettings() { assertTrue(settings.hasKonvGroupSettings()); }