Exemplo n.º 1
0
 @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);
 }
Exemplo n.º 2
0
 @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);
 }
Exemplo n.º 3
0
  @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);
  }