DLPConfigurationItem { public static Builder builder() { return new Builder(); } private  DLPConfigurationItem(Id id, Optional<String> explanation, Pattern regexp, Targets targets); static Builder builder(); Optional<String> getExplanation(); Pattern getRegexp(); Targets getTargets(); Id getId(); @Override final boolean equals(Object o); @Override final int hashCode(); @Override String toString();  }
@Test void idShouldBeMandatory() { assertThatThrownBy(() -> DLPConfigurationItem.builder() .expression("my expression") .targetsRecipients() .targetsSender() .targetsContent() .explanation(EXPLANATION) .build()) .isInstanceOf(IllegalStateException.class); }
@Test void expressionShouldBeMandatory() { assertThatThrownBy(() -> DLPConfigurationItem.builder() .id(UNIQUE_ID) .targetsRecipients() .targetsSender() .targetsContent() .explanation(EXPLANATION) .build()) .isInstanceOf(IllegalStateException.class); }
@Test void expressionAndIdShouldBeTheOnlyMandatoryFields() { assertThatCode(() -> DLPConfigurationItem.builder() .id(UNIQUE_ID) .expression(REGEX) .build()) .doesNotThrowAnyException(); }
@Test void expressionShouldBeValidPattern() { assertThatThrownBy(() -> DLPConfigurationItem.builder() .id(UNIQUE_ID) .expression("*") .build()) .isInstanceOf(IllegalStateException.class); }