Version extends Resource { public static Version get(RestClient restclient, String id) throws JiraException { JSON result = null; try { result = restclient.get(getBaseUri() + "version/" + id); } catch (Exception ex) { throw new JiraException("Failed to retrieve version " + id, ex); } if (!(result instanceof JSONObject)) throw new JiraException("JSON payload is malformed"); return new Version(restclient, (JSONObject) result); } protected  Version(RestClient restclient, JSONObject json); void mergeWith(Version version); void copyTo(Project project); static Version get(RestClient restclient, String id); @Override String toString(); String getName(); boolean isArchived(); boolean isReleased(); String getReleaseDate(); String getDescription(); static FluentCreate create(RestClient restclient, String project);  }
@Test(expected = JiraException.class) public void testJiraExceptionFromRestException() throws Exception { final RestClient mockRestClient = PowerMockito.mock(RestClient.class); PowerMockito.when(mockRestClient.get(anyString())).thenThrow(RestException.class); Version.get(mockRestClient, "id"); }
@Test(expected = JiraException.class) public void testJiraExceptionFromNonJSON() throws Exception { final RestClient mockRestClient = PowerMockito.mock(RestClient.class); Version.get(mockRestClient, "id"); }