@Test public void startStopTimeEntry() throws Exception { TimeEntry current = jToggl.getCurrentTimeEntry(); Assert.assertNull(current); TimeEntry timeEntry = new TimeEntry(); timeEntry.setWorkspace(workspace); timeEntry.setProject(project); timeEntry.setDescription("ABCD"); timeEntry.setCreated_with("JToggl Unit Test"); TimeEntry te = jToggl.startTimeEntry(timeEntry); try { Assert.assertNotNull(te.getId()); // created Assert.assertTrue(te.getDuration() < 0); // running current = jToggl.getCurrentTimeEntry(); Assert.assertNotNull(current); Assert.assertEquals(current.getId(), te.getId()); Thread.sleep(2000); TimeEntry stoppedTe = jToggl.stopTimeEntry(te); Assert.assertEquals(te.getId(), stoppedTe.getId()); Assert.assertTrue(stoppedTe.toJSONString(), stoppedTe.getDuration() > 1); // stopped current = jToggl.getCurrentTimeEntry(); Assert.assertNull(current); } finally { jToggl.destroyTimeEntry(te.getId()); } }