Watches extends Resource { public static Watches get(RestClient restclient, String issue) throws JiraException { JSON result = null; try { result = restclient.get(getBaseUri() + "issue/" + issue + "/watches"); } catch (Exception ex) { throw new JiraException("Failed to retrieve watches for issue " + issue, ex); } if (!(result instanceof JSONObject)) throw new JiraException("JSON payload is malformed"); return new Watches(restclient, (JSONObject)result); } protected  Watches(RestClient restclient, JSONObject json); static Watches get(RestClient restclient, String issue); @Override String toString(); int getWatchCount(); boolean isWatching();  }
@Test(expected = JiraException.class) public void testGetWatchersNullReturned() throws Exception { final RestClient restClient = PowerMockito.mock(RestClient.class); PowerMockito.when(restClient.get(anyString())).thenReturn(null); Watches.get(restClient, "someID"); }
@Test(expected = JiraException.class) public void testGetWatchersGetThrows() throws Exception { final RestClient restClient = PowerMockito.mock(RestClient.class); PowerMockito.when(restClient.get(anyString())).thenThrow(Exception.class); Watches.get(restClient, "someID"); }