WorkLog extends Resource { @Override public String toString() { return created + " by " + author; } 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 public void testToString() throws Exception { final RestClient mockRestClient = PowerMockito.mock(RestClient.class); final JSONObject mockJSONObject = new JSONObject(); String dateString = "2015-12-24"; mockJSONObject.put("created",dateString); final JSONObject userJSON = new JSONObject(); userJSON.put("name","Joseph McCarthy"); mockJSONObject.put("author", userJSON); WorkLog workLog = new WorkLog(mockRestClient,mockJSONObject); assertEquals(workLog.getCreatedDate() + " by Joseph McCarthy",workLog.toString()); }