PatternPage extends BaseDecisionTableColumnPage<T> { Set<PatternWrapper> getPatterns() { final Set<PatternWrapper> patterns = plugin().getPatterns(); if (isPatternSet()) { patterns.add(currentPattern()); } if (isNegatedPatternEnabled()) { return patterns; } return patterns .stream() .filter(pattern -> !pattern.isNegated()) .collect(Collectors.toSet()); } @Inject  PatternPage(final View view,
                       final NewPatternPresenter newPatternPresenter,
                       final TranslationService translationService); @Override void initialise(); @Override String getTitle(); @Override void isComplete(final Callback<Boolean> callback); @Override void prepareView(); GuidedDecisionTableView.Presenter presenter(); void setEditingPattern(final PatternWrapper wrapper); void disableEntryPoint(); boolean isNegatedPatternEnabled(); void disableNegatedPatterns(); boolean isPatternCreationEnabled(); void disablePatternCreation();  }
@Test public void testGetPatternsWhenCurrentPatternIsNull() { when(plugin.getPatterns()).thenReturn(fakePatterns()); final Set<PatternWrapper> patterns = page.getPatterns(); assertEquals(2, patterns.size()); }
@Test public void testGetPatternsWhenCurrentPatternIsNotNull() { when(plugin.getPatterns()).thenReturn(fakePatterns()); when(plugin.patternWrapper()).thenReturn(newPattern("factType3", "boundName3", true)); final Set<PatternWrapper> patterns = page.getPatterns(); assertEquals(3, patterns.size()); }