@Test(expected = NoSuchElementException.class) public void testParseUsernameWithoutTheKeyMessageInTheJSON() { githubRequest = RequestValues.getRequest9(); hook = new JiraServiceHook(); hook.setGithubRequest(githubRequest); hook.convertGithubRequestToJson(); hook.parseGithubJson(); }
@Test(expected = NullPointerException.class) public void testParseUsernameWithoutTheKeyUsernameInTheJSON() { githubRequest = RequestValues.getRequest10(); hook = new JiraServiceHook(); hook.setGithubRequest(githubRequest); hook.convertGithubRequestToJson(); hook.parseGithubJson(); }
@Test public void testParseUsernameWithAValidUsername() { String expected = "bennyn"; String result = null; githubRequest = RequestValues.getRequest1(); hook = new JiraServiceHook(); hook.setGithubRequest(githubRequest); hook.convertGithubRequestToJson(); hook.parseGithubJson(); result = hook.getUsername(); assertEquals("Test if a username can be parsed from a github request.", expected, result); }