UsersTemplate extends AbstractGithubTemplate implements UsersOperations { @Override public List<Email> addEmails(String... emails) { return addEmails(Arrays.asList(emails)); } UsersTemplate(RestOperations restOperations); @Override List<Email> listEmails(); @Override List<Email> addEmails(String... emails); @Override List<Email> addEmails(List<String> emails); @Override void deleteEmails(String... emails); @Override void deleteEmails(List<String> emails); @Override List<PubKey> listPublicKeys(String username); @Override List<ExtPubKey> listPublicKeys(); @Override ExtPubKey getPublicKey(long id); @Override ExtPubKey createPublicKey(PubKeyInput pubKey); @Override void deletePublicKey(long id); static final String USER_EMAILS_PATH; }
@Test public void addEmails() throws Exception { mockServer.expect(requestTo("https: .andRespond( withSuccess(new ClassPathResource("addEmails.json", getClass()), MediaType.APPLICATION_JSON)); List<Email> emailList = usersTemplate.addEmails("octocat@github.com", "support@github.com"); Assertions.assertThat(emailList).isNotNull(); Assertions.assertThat(emailList.size()).isEqualTo(2); }