@Test public void getByTitle_shouldReturnDashboards_whenClientReturnsNotUniqueResult() { when(responseMock.readEntity(DashboardList.class)).thenReturn(new DashboardList(asList( Dashboard.builder().title(DASHBOARD_FILTER_VALUE).build(), Dashboard.builder().title("dashboard1").build() ))); List<Dashboard> dashboard = testee.getByTitle(DASHBOARD_FILTER_VALUE); assertThat(dashboard).isNotEmpty(); assertThat(dashboard).hasSize(2); }
@Override public List<Dashboard> getByTitle(String dashboardTitle) { String dashboardTitleEncoded = UriComponent.encode(dashboardTitle, QUERY_PARAM_SPACE_ENCODED); Invocation.Builder builder = client .target(DASHBOARDS_URL) .queryParam("filter[title]", dashboardTitleEncoded) .request(APPLICATION_JSON_TYPE); return getPageable(builder, DashboardList.class) .getList(); }
DefaultDashboardsApi extends ApiBase implements DashboardsApi { @Override public List<Dashboard> getByTitle(String dashboardTitle) { String dashboardTitleEncoded = UriComponent.encode(dashboardTitle, QUERY_PARAM_SPACE_ENCODED); Invocation.Builder builder = client .target(DASHBOARDS_URL) .queryParam("filter[title]", dashboardTitleEncoded) .request(APPLICATION_JSON_TYPE); return getPageable(builder, DashboardList.class) .getList(); } }
DefaultDashboardsApi extends ApiBase implements DashboardsApi { @Override public List<Dashboard> getByTitle(String dashboardTitle) { String dashboardTitleEncoded = UriComponent.encode(dashboardTitle, QUERY_PARAM_SPACE_ENCODED); Invocation.Builder builder = client .target(DASHBOARDS_URL) .queryParam("filter[title]", dashboardTitleEncoded) .request(APPLICATION_JSON_TYPE); return getPageable(builder, DashboardList.class) .getList(); } DefaultDashboardsApi(NewRelicClient client); }
DefaultDashboardsApi extends ApiBase implements DashboardsApi { @Override public List<Dashboard> getByTitle(String dashboardTitle) { String dashboardTitleEncoded = UriComponent.encode(dashboardTitle, QUERY_PARAM_SPACE_ENCODED); Invocation.Builder builder = client .target(DASHBOARDS_URL) .queryParam("filter[title]", dashboardTitleEncoded) .request(APPLICATION_JSON_TYPE); return getPageable(builder, DashboardList.class) .getList(); } DefaultDashboardsApi(NewRelicClient client); @Override Dashboard getById(int dashboardId); @Override List<Dashboard> getByTitle(String dashboardTitle); @Override Dashboard create(Dashboard dashboard); @Override Dashboard update(Dashboard dashboard); @Override Dashboard delete(int dashboardId); }
DefaultDashboardsApi extends ApiBase implements DashboardsApi { @Override public List<Dashboard> getByTitle(String dashboardTitle) { String dashboardTitleEncoded = UriComponent.encode(dashboardTitle, QUERY_PARAM_SPACE_ENCODED); Invocation.Builder builder = client .target(DASHBOARDS_URL) .queryParam("filter[title]", dashboardTitleEncoded) .request(APPLICATION_JSON_TYPE); return getPageable(builder, DashboardList.class) .getList(); } DefaultDashboardsApi(NewRelicClient client); @Override Dashboard getById(int dashboardId); @Override List<Dashboard> getByTitle(String dashboardTitle); @Override Dashboard create(Dashboard dashboard); @Override Dashboard update(Dashboard dashboard); @Override Dashboard delete(int dashboardId);  }