### Question:
PageCompareDataImpl implements PageCompareData { @Override public List<PageCompareDataLine> getLines() { return lines; } PageCompareDataImpl(Resource resource, String versionName); @Override Resource getResource(); @Override String getVersion(); @Override Date getVersionDate(); @Override String getPath(); @Override List<VersionSelection> getVersions(); @Override List<PageCompareDataLine> getLines();  }### Answer:
@Test public void getLines() throws RepositoryException { final Resource resource = mockResource("/my/path", "latest", new Date()); final Set<String> valueMapKeys = Sets.newHashSet("a", "b"); final Property a = mockProperty("a", "/my/path/a", "value a"); when(resource.adaptTo(Node.class).getProperty("a")).thenReturn(a); final Property b = mockProperty("b", "/my/path/b", "value b"); when(resource.adaptTo(Node.class).getProperty("b")).thenReturn(b); when(resource.getValueMap().keySet()).thenReturn(valueMapKeys); final PageCompareData pageCompareData = new PageCompareDataImpl(resource, "latest"); final List<PageCompareDataLine> lines = pageCompareData.getLines(); assertThat(lines, not(Collections.<PageCompareDataLine>emptyList())); assertThat(lines.get(0).getName(), is("a")); assertThat(lines.get(1).getName(), is("b")); }
@Test public void getRecursiveLines() throws RepositoryException { final Resource resource = mockResource("/my/path", "latest", new Date()); final Set<String> valueMapKeys = Sets.newHashSet("a", "b"); final Property a = mockProperty("a", "/my/path/a", "value a"); when(resource.adaptTo(Node.class).getProperty("a")).thenReturn(a); final Property b = mockProperty("b", "/my/path/b", "value b"); when(resource.adaptTo(Node.class).getProperty("b")).thenReturn(b); when(resource.getValueMap().keySet()).thenReturn(valueMapKeys); final Resource childC = mockResource("/my/path/c", "latest", new Date()); when(childC.getName()).thenReturn("c"); final Resource childD = mockResource("/my/path/d", "latest", new Date()); when(childD.getName()).thenReturn("d"); final Property e = mockProperty("e", "/my/path/d/e", "value e"); when(childD.adaptTo(Node.class).getProperty("e")).thenReturn(e); when(childD.getValueMap().keySet()).thenReturn(Sets.newHashSet("e")); final List<Resource> children = Lists.newArrayList(childC, childD); when(resource.getChildren()).thenReturn(children); final PageCompareData pageCompareData = new PageCompareDataImpl(resource, "latest"); final List<PageCompareDataLine> lines = pageCompareData.getLines(); assertThat(lines, not(Collections.<PageCompareDataLine>emptyList())); assertThat(lines.get(0).getName(), is("a")); assertThat(lines.get(1).getName(), is("b")); assertThat(lines.get(2).getName(), is("c")); assertThat(lines.get(3).getName(), is("d")); assertThat(lines.get(4).getName(), is("e")); }