@Test public void shouldBuildAppropriateJsonRequestForServerInfo() throws Exception { mWebMockRule.enqueue( MockResponseFactory.create200().setBody("{}") ); ServerInfoData serverInfoData = objectUnderTest.requestServerInfo(); assertThat("Response not null value", serverInfoData, is(notNullValue())); RecordedRequest recordedRequest = mWebMockRule.get().takeRequest(); assertThat("Should accept json header", recordedRequest, containsHeader("Accept", "application/json; charset=UTF-8")); assertThat("Should have path '/rest_v2/serverInfo'", recordedRequest, hasPath("/rest_v2/serverInfo")); }
@NotNull public ServerInfoData requestServerInfo() throws IOException, HttpException { HttpUrl httpUrl = mClientWrapper.getBaseUrl().resolve("rest_v2/serverInfo"); Request request = new Request.Builder() .addHeader("Accept", "application/json; charset=UTF-8") .url(httpUrl) .get() .build(); Response response = mClientWrapper.makeCall(request); return mClientWrapper.deserializeJson(response, ServerInfoData.class); }
ServerRestApi { @NotNull public ServerInfoData requestServerInfo() throws IOException, HttpException { HttpUrl httpUrl = mClientWrapper.getBaseUrl().resolve("rest_v2/serverInfo"); Request request = new Request.Builder() .addHeader("Accept", "application/json; charset=UTF-8") .url(httpUrl) .get() .build(); Response response = mClientWrapper.makeCall(request); return mClientWrapper.deserializeJson(response, ServerInfoData.class); } }
ServerRestApi { @NotNull public ServerInfoData requestServerInfo() throws IOException, HttpException { HttpUrl httpUrl = mClientWrapper.getBaseUrl().resolve("rest_v2/serverInfo"); Request request = new Request.Builder() .addHeader("Accept", "application/json; charset=UTF-8") .url(httpUrl) .get() .build(); Response response = mClientWrapper.makeCall(request); return mClientWrapper.deserializeJson(response, ServerInfoData.class); } ServerRestApi(NetworkClient networkClient); }
ServerRestApi { @NotNull public ServerInfoData requestServerInfo() throws IOException, HttpException { HttpUrl httpUrl = mClientWrapper.getBaseUrl().resolve("rest_v2/serverInfo"); Request request = new Request.Builder() .addHeader("Accept", "application/json; charset=UTF-8") .url(httpUrl) .get() .build(); Response response = mClientWrapper.makeCall(request); return mClientWrapper.deserializeJson(response, ServerInfoData.class); } ServerRestApi(NetworkClient networkClient); @NotNull ServerInfoData requestServerInfo(); @NotNull String requestBuild(); @NotNull String requestEdition(); @NotNull String requestVersion(); @NotNull String requestFeatures(); @NotNull String requestEditionName(); @NotNull String requestLicenseType(); @NotNull String requestExpiration(); @NotNull String requestDateFormatPattern(); @NotNull String requestDateTimeFormatPattern(); }
ServerRestApi { @NotNull public ServerInfoData requestServerInfo() throws IOException, HttpException { HttpUrl httpUrl = mClientWrapper.getBaseUrl().resolve("rest_v2/serverInfo"); Request request = new Request.Builder() .addHeader("Accept", "application/json; charset=UTF-8") .url(httpUrl) .get() .build(); Response response = mClientWrapper.makeCall(request); return mClientWrapper.deserializeJson(response, ServerInfoData.class); } ServerRestApi(NetworkClient networkClient); @NotNull ServerInfoData requestServerInfo(); @NotNull String requestBuild(); @NotNull String requestEdition(); @NotNull String requestVersion(); @NotNull String requestFeatures(); @NotNull String requestEditionName(); @NotNull String requestLicenseType(); @NotNull String requestExpiration(); @NotNull String requestDateFormatPattern(); @NotNull String requestDateTimeFormatPattern();  }