@Test public void testCopyTo() throws Exception { final RestClient mockRestClient = PowerMockito.mock(RestClient.class); final JSONObject mockJSON = PowerMockito.mock(JSONObject.class); Version version = new Version(mockRestClient,getTestJSON()); version.copyTo(new Project(mockRestClient,mockJSON)); verify(mockRestClient, times(1)).post(anyString(),any(JSONObject.class)); }
public void copyTo(Project project) throws JiraException { JSONObject req = new JSONObject(); req.put("description", getDescription()); req.put("name", getName()); req.put("archived", isArchived()); req.put("released", isReleased()); req.put("releaseDate", getReleaseDate()); req.put("project", project.getKey()); req.put("projectId", project.getId()); try { restclient.post(Resource.getBaseUri() + "version/", req); } catch (Exception ex) { throw new JiraException("Failed to copy to project '" + project.getKey() + "'", ex); } }
Version extends Resource { public void copyTo(Project project) throws JiraException { JSONObject req = new JSONObject(); req.put("description", getDescription()); req.put("name", getName()); req.put("archived", isArchived()); req.put("released", isReleased()); req.put("releaseDate", getReleaseDate()); req.put("project", project.getKey()); req.put("projectId", project.getId()); try { restclient.post(Resource.getBaseUri() + "version/", req); } catch (Exception ex) { throw new JiraException("Failed to copy to project '" + project.getKey() + "'", ex); } } }
Version extends Resource { public void copyTo(Project project) throws JiraException { JSONObject req = new JSONObject(); req.put("description", getDescription()); req.put("name", getName()); req.put("archived", isArchived()); req.put("released", isReleased()); req.put("releaseDate", getReleaseDate()); req.put("project", project.getKey()); req.put("projectId", project.getId()); try { restclient.post(Resource.getBaseUri() + "version/", req); } catch (Exception ex) { throw new JiraException("Failed to copy to project '" + project.getKey() + "'", ex); } } protected  Version(RestClient restclient, JSONObject json); }
Version extends Resource { public void copyTo(Project project) throws JiraException { JSONObject req = new JSONObject(); req.put("description", getDescription()); req.put("name", getName()); req.put("archived", isArchived()); req.put("released", isReleased()); req.put("releaseDate", getReleaseDate()); req.put("project", project.getKey()); req.put("projectId", project.getId()); try { restclient.post(Resource.getBaseUri() + "version/", req); } catch (Exception ex) { throw new JiraException("Failed to copy to project '" + project.getKey() + "'", ex); } } 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); }
Version extends Resource { public void copyTo(Project project) throws JiraException { JSONObject req = new JSONObject(); req.put("description", getDescription()); req.put("name", getName()); req.put("archived", isArchived()); req.put("released", isReleased()); req.put("releaseDate", getReleaseDate()); req.put("project", project.getKey()); req.put("projectId", project.getId()); try { restclient.post(Resource.getBaseUri() + "version/", req); } catch (Exception ex) { throw new JiraException("Failed to copy to project '" + project.getKey() + "'", ex); } } 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);  }