TimeTracking { protected JSONObject toJsonObject() { JSONObject object = new JSONObject(); if (originalEstimate != null) object.put("originalEstimate", originalEstimate); if (remainingEstimate != null) object.put("remainingEstimate", remainingEstimate); if (originalEstimateSeconds >= 0) object.put("originalEstimateSeconds", originalEstimateSeconds); if (remainingEstimateSeconds >= 0) object.put("remainingEstimateSeconds", remainingEstimateSeconds); return object; } protected  TimeTracking(JSONObject json);  TimeTracking();  TimeTracking(TimeTracking tt); String getOriginalEstimate(); String getRemainingEstimate(); String getTimeSpent(); int getOriginalEstimateSeconds(); int getRemainingEstimateSeconds(); void setOriginalEstimate(String originalEstimate); void setRemainingEstimate(String remainingEstimate); void setOrignalEstimateSeconds(int originalEstimateSeconds); void setRemainingEstimateSeconds(int remainingEstimateSeconds); int getTimeSpentSeconds();  }
@Test public void testToJSONObject() throws Exception { final JSONObject testJson = new JSONObject(); testJson.put("originalEstimate", "1 day"); testJson.put("remainingEstimate", "2 days"); testJson.put("originalEstimateSeconds", 12); testJson.put("remainingEstimateSeconds", 10); TimeTracking timeTracking = new TimeTracking(testJson); final JSONObject jsonObject = timeTracking.toJsonObject(); assertEquals(testJson,jsonObject); }