/** Verifies that the object can be initialized from a JSON string. */ @Test public void shouldInitializeFromJsonString() { FavoriteUpdateRequest request = new FavoriteUpdateRequest(createJsonString(27, "abc123", true)); assertEquals(27, request.getWorkspaceId()); assertEquals("abc123", request.getAnalysisId()); assertTrue(request.isFavorite()); }
/** Verifies that the object can be converted to a JSON object. */ @Test public void shouldConvertToJsonObject() { FavoriteUpdateRequest request = new FavoriteUpdateRequest(42, "quux", false); JSONObject json = request.toJson(); assertEquals(42, json.getLong("workspace_id")); assertEquals("quux", json.getString("analysis_id")); assertFalse(request.isFavorite()); }