Skip to content
Permalink
Browse files

feat(tree): fetch pages recursively

  • Loading branch information...
aelamrani committed Feb 25, 2019
1 parent e16bd32 commit 692bc49657f17d86083028f4071584437ff63521
@@ -42,15 +42,15 @@ protected String contextPath() {
@Test
public void shoudGetNoFetchersFromEmptyList() {
Mockito.reset(fetcherService);
when(fetcherService.findAll()).thenReturn(Collections.emptySet());
when(fetcherService.findAll(false)).thenReturn(Collections.emptySet());

final Response response = target().request().get();

assertThat(response).isNotNull();
assertThat(response.getStatus()).isEqualTo(HttpStatusCode.OK_200);
assertThat(response.readEntity(Set.class)).isEmpty();

verify(fetcherService, times(1)).findAll();
verify(fetcherService, times(1)).findAll(false);
verify(fetcherService, times(0)).getSchema(anyString());
}

@@ -60,7 +60,7 @@ public void shouldGetFetcherWithoutSchema() {
FetcherEntity fetcherEntity = new FetcherEntity();
fetcherEntity.setId("my-id");

when(fetcherService.findAll()).thenReturn(Collections.singleton(fetcherEntity));
when(fetcherService.findAll(false)).thenReturn(Collections.singleton(fetcherEntity));
when(fetcherService.getSchema(anyString())).thenReturn("schema");

final Response response = target().request().get();
@@ -77,7 +77,7 @@ public void shouldGetFetcherWithoutSchema() {
assertThat(elt).hasSize(1);
assertThat(elt.get("id")).isEqualTo("my-id");

verify(fetcherService, times(1)).findAll();
verify(fetcherService, times(1)).findAll(false);
verify(fetcherService, times(0)).getSchema(anyString());
}

@@ -87,7 +87,7 @@ public void shouldGetFetcherWithExpandSchema() {
FetcherEntity fetcherEntity = new FetcherEntity();
fetcherEntity.setId("my-id");

when(fetcherService.findAll()).thenReturn(Collections.singleton(fetcherEntity));
when(fetcherService.findAll(false)).thenReturn(Collections.singleton(fetcherEntity));
when(fetcherService.getSchema(anyString())).thenReturn("my-schema");

final Response response = target().queryParam("expand", "schema").request().get();
@@ -105,7 +105,7 @@ public void shouldGetFetcherWithExpandSchema() {
assertThat(elt.get("id")).isEqualTo("my-id");
assertThat(elt.get("schema")).isEqualTo("my-schema");

verify(fetcherService, times(1)).findAll();
verify(fetcherService, times(1)).findAll(false);
verify(fetcherService, times(1)).getSchema(anyString());
}

@@ -115,7 +115,7 @@ public void shouldGetFetcherWithUnknownExpand() {
FetcherEntity fetcherEntity = new FetcherEntity();
fetcherEntity.setId("my-id");

when(fetcherService.findAll()).thenReturn(Collections.singleton(fetcherEntity));
when(fetcherService.findAll(false)).thenReturn(Collections.singleton(fetcherEntity));
when(fetcherService.getSchema(anyString())).thenReturn("my-schema");

final Response response = target().queryParam("expand", "unknown").request().get();
@@ -132,7 +132,7 @@ public void shouldGetFetcherWithUnknownExpand() {
assertThat(elt).hasSize(1);
assertThat(elt.get("id")).isEqualTo("my-id");

verify(fetcherService, times(1)).findAll();
verify(fetcherService, times(1)).findAll(false);
verify(fetcherService, times(0)).getSchema(anyString());
}
}

0 comments on commit 692bc49

Please sign in to comment.
You can’t perform that action at this time.