WorkLog extends Resource { public static WorkLog get(RestClient restclient, String issue, String id) throws JiraException { JSON result = null; try { result = restclient.get(getBaseUri() + "issue/" + issue + "/worklog/" + id); } catch (Exception ex) { throw new JiraException("Failed to retrieve work log " + id + " on issue " + issue, ex); } if (!(result instanceof JSONObject)) throw new JiraException("JSON payload is malformed"); return new WorkLog(restclient, (JSONObject)result); } protected  WorkLog(RestClient restclient, JSONObject json); static WorkLog get(RestClient restclient, String issue, String id); @Override String toString(); User getAuthor(); String getComment(); Date getCreatedDate(); User getUpdateAuthor(); Date getUpdatedDate(); Date getStarted(); String getTimeSpent(); int getTimeSpentSeconds();  }
@Test(expected = JiraException.class) public void testJiraExceptionFromRestException() throws Exception { final RestClient mockRestClient = PowerMockito.mock(RestClient.class); PowerMockito.when(mockRestClient.get(anyString())).thenThrow(RestException.class); WorkLog.get(mockRestClient, "issueNumber", "someID"); }
@Test(expected = JiraException.class) public void testJiraExceptionFromNonJSON() throws Exception { final RestClient mockRestClient = PowerMockito.mock(RestClient.class); WorkLog.get(mockRestClient,"issueNumber","someID"); }