NamedView extends View { public List<String> getMergedNamedViewNames() { return mergedNamedViewNames; } NamedView(); void setName(final String viewName); String getName(); void setMergedNamedViewNames(final List<String> mergedNamedViewNames); List<String> getMergedNamedViewNames(); void setParameters(final Map<String, Object> parameters); Map<String, Object> getParameters(); @Override boolean canMerge(final View addingView, final View srcView); @Override void expandGlobalDefinitions();  }
@Test public void shouldNotAddNameToMergedNamedViewsListIfNameIsTheSameAsTheNamedViewName() { final String namedViewName = "namedViewName"; final NamedView namedViewToMerge = new NamedView.Builder() .name(namedViewName) .edge(TestGroups.EDGE) .build(); final NamedView namedViewMerged = new NamedView.Builder() .name(namedViewName) .merge(namedViewToMerge) .build(); assertFalse(namedViewMerged.getMergedNamedViewNames().contains(namedViewName)); }
@Test public void shouldAddAllMergedNamedViewNamesToTopLevelNamedView() { final String namedViewName = "namedViewName"; final NamedView namedViewToMerge3 = new NamedView.Builder() .name(namedViewName + 3) .edge(TestGroups.EDGE_2) .build(); final NamedView namedViewToMerge2 = new NamedView.Builder() .name(namedViewName + 2) .merge(namedViewToMerge3) .edge(TestGroups.EDGE) .build(); final NamedView namedViewToMerge1 = new NamedView.Builder() .name(namedViewName + 1) .merge(namedViewToMerge2) .entity(TestGroups.ENTITY) .build(); final NamedView namedViewMerged = new NamedView.Builder() .name(namedViewName) .merge(namedViewToMerge1) .build(); assertEquals(3, namedViewMerged.getMergedNamedViewNames().size()); assertEquals(Arrays.asList(namedViewName + 1, namedViewName + 2, namedViewName + 3), namedViewMerged.getMergedNamedViewNames()); }