@Override public Resource create(XingApi api) { return new ProfileEditingResource(api); } };
@Test public void deleteMessagingAccount() throws Exception { testVoidSpec(resource.deleteMessagingAccount(MessagingAccount.SKYPE)); }
@Test public void deleteOwnProfilePicture() throws Exception { testVoidSpec(resource.deleteProfilePicture()); }
@Test public void deleteSchool() throws Exception { testVoidSpec(resource.deleteSchool("id")); }
@Test public void deleteCompany() throws Exception { testVoidSpec(resource.deleteCompany("some_id")); }
@Test public void deleteLanguage() throws Exception { testVoidSpec(resource.deleteLanguage(Language.FR)); }
@Test public void deleteWebProfile() throws Exception { testVoidSpec(resource.deleteWebProfile(WebProfile.AMAZON)); }
@Test public void addQualification() throws Exception { server.enqueue(new MockResponse().setResponseCode(201).setBody("{\n" + " \"qualifications\": [\n" + " \"API programming champion 2016\",\n" + " \"Linux Daemons\"\n" + " ]\n" + '}')); Response<List<String>, HttpError> response = resource.addQualification("Some desc").execute(); // If no exception was thrown then the spec is build correctly. assertThat(response.body().size()).isEqualTo(2); assertThat(response.body().get(1)).isEqualTo("Linux Daemons"); }
@Test public void addCompany() throws Exception { server.enqueue(new MockResponse().setResponseCode(201).setBody(BODY_COMPANY)); Response<Company, HttpError> response = resource.addCompany("Name", "Title", FormOfEmployment .FULL_TIME_EMPLOYEE).execute(); // If no exception was thrown then the spec is build correctly. assertThat(response.body()).isNotNull(); assertThat(response.body().id()).isEqualTo("23_abcdef"); }
@Test public void addSchoolToOwnProfile() throws Exception { MockResponse mockResponse = new MockResponse().setBody("{\n" + " \"school\": {\n" + " \"id\": \"42\",\n" + " \"name\": \"University of Hamburg\",\n" + " \"subject\": null,\n" + " \"degree\": null,\n" + " \"begin_date\": null,\n" + " \"end_date\": null,\n" + " \"notes\": null\n" + " }\n" + '}'); server.enqueue(mockResponse); server.enqueue(mockResponse); Response<School, HttpError> response1 = resource.addSchool("University of Hamburg").execute(); // If no exception was thrown then the spec is build correctly. assertThat(response1.body().id()).isEqualTo("42"); // This would require a name, but the server prevents that in the real world. Response<School, HttpError> response2 = resource.addSchool(new School()).execute(); // If no exception was thrown then the spec is build correctly. assertThat(response2.body().id()).isEqualTo("42"); }