@Test public void setStatusChangesStatus() { Consent consent = new DefaultConsent(ID_STRING, DESCRIPTION_STRING, false); consent.setStatus(ConsentStatus.NO); Assert.assertSame(consent.getStatus(), ConsentStatus.NO); consent.setStatus(ConsentStatus.YES); Assert.assertSame(consent.getStatus(), ConsentStatus.YES); }
@Test public void copiesCorrectly() { ConsentStatus status = ConsentStatus.NO; boolean required = false; Consent original = new DefaultConsent(ID_STRING, DESCRIPTION_STRING, required); original.setStatus(status); Consent copy = DefaultConsent.copy(original); Assert.assertSame(copy.getId(), ID_STRING); Assert.assertSame(copy.getDescription(), DESCRIPTION_STRING); Assert.assertSame(copy.getStatus(), status); Assert.assertSame(copy.isRequired(), required); }
@Test public void producesCorrectJson() { ConsentStatus status = ConsentStatus.NO; boolean required = false; Consent consent = new DefaultConsent(ID_STRING, DESCRIPTION_STRING, required); consent.setStatus(status); JSONObject json = consent.toJson(); Assert.assertNotNull(json); Assert.assertSame(json.getString("id"), ID_STRING); Assert.assertSame(json.getString("description"), DESCRIPTION_STRING); Assert.assertSame(json.getString("status"), status.toString()); Assert.assertSame(json.getBoolean("isRequired"), required); }