*/
public class JpaPdpSubGroupTest {
- private static final String NULL_KEY_ERROR = "key is marked @NonNull but is null";
+ private static final String NULL_KEY_ERROR = "key is marked .*ull but is null";
private static final String PDP_A = "PDP-A";
@Test
public void testJpaPdpSubGroup() {
assertThatThrownBy(() -> {
new JpaPdpSubGroup((JpaPdpSubGroup) null);
- }).hasMessage("copyConcept is marked @NonNull but is null");
+ }).hasMessageMatching("copyConcept is marked .*ull but is null");
assertThatThrownBy(() -> {
new JpaPdpSubGroup((PfReferenceKey) null);
- }).hasMessage(NULL_KEY_ERROR);
+ }).hasMessageMatching(NULL_KEY_ERROR);
assertThatThrownBy(() -> {
new JpaPdpSubGroup((PdpSubGroup) null);
- }).hasMessage("authorativeConcept is marked @NonNull but is null");
+ }).hasMessageMatching("authorativeConcept is marked .*ull but is null");
assertThatThrownBy(() -> {
new JpaPdpSubGroup(null, null, null, null);
- }).hasMessage(NULL_KEY_ERROR);
+ }).hasMessageMatching(NULL_KEY_ERROR);
assertThatThrownBy(() -> {
new JpaPdpSubGroup(new PfReferenceKey(), null, null, null);
- }).hasMessage("supportedPolicyTypes is marked @NonNull but is null");
+ }).hasMessageMatching("supportedPolicyTypes is marked .*ull but is null");
assertThatThrownBy(() -> {
new JpaPdpSubGroup(new PfReferenceKey(), new ArrayList<>(), null, null);
- }).hasMessage("policies is marked @NonNull but is null");
+ }).hasMessageMatching("policies is marked .*ull but is null");
assertThatThrownBy(() -> {
new JpaPdpSubGroup(null, new ArrayList<>(), null, null);
- }).hasMessage(NULL_KEY_ERROR);
+ }).hasMessageMatching(NULL_KEY_ERROR);
assertThatThrownBy(() -> {
new JpaPdpSubGroup(null, new ArrayList<>(), new ArrayList<>(), null);
- }).hasMessage(NULL_KEY_ERROR);
+ }).hasMessageMatching(NULL_KEY_ERROR);
assertThatThrownBy(() -> {
new JpaPdpSubGroup(null, null, new ArrayList<>(), null);
- }).hasMessage(NULL_KEY_ERROR);
+ }).hasMessageMatching(NULL_KEY_ERROR);
assertThatThrownBy(() -> {
new JpaPdpSubGroup(null, null, null, new ArrayList<>());
- }).hasMessage(NULL_KEY_ERROR);
+ }).hasMessageMatching(NULL_KEY_ERROR);
assertThatThrownBy(() -> {
new JpaPdpSubGroup(new PfReferenceKey(), null, null, new ArrayList<>());
- }).hasMessage("supportedPolicyTypes is marked @NonNull but is null");
+ }).hasMessageMatching("supportedPolicyTypes is marked .*ull but is null");
assertThatThrownBy(() -> {
new JpaPdpSubGroup(new PfReferenceKey(), new ArrayList<>(), null, new ArrayList<>());
- }).hasMessage("policies is marked @NonNull but is null");
+ }).hasMessageMatching("policies is marked .*ull but is null");
assertThatThrownBy(() -> {
new JpaPdpSubGroup(null, new ArrayList<>(), null, new ArrayList<>());
- }).hasMessage(NULL_KEY_ERROR);
+ }).hasMessageMatching(NULL_KEY_ERROR);
assertThatThrownBy(() -> {
new JpaPdpSubGroup(null, new ArrayList<>(), new ArrayList<>(), new ArrayList<>());
- }).hasMessage(NULL_KEY_ERROR);
+ }).hasMessageMatching(NULL_KEY_ERROR);
assertThatThrownBy(() -> {
new JpaPdpSubGroup(null, null, new ArrayList<>(), null);
- }).hasMessage(NULL_KEY_ERROR);
+ }).hasMessageMatching(NULL_KEY_ERROR);
assertNotNull(new JpaPdpSubGroup((new PfReferenceKey())));
assertThatThrownBy(() -> {
testJpaPdpSubGroup.fromAuthorative(null);
- }).hasMessage("pdpSubgroup is marked @NonNull but is null");
+ }).hasMessageMatching("pdpSubgroup is marked .*ull but is null");
assertThatThrownBy(() -> new JpaPdpSubGroup((JpaPdpSubGroup) null)).isInstanceOf(NullPointerException.class);
assertThatThrownBy(() -> {
testJpaPdpSubGroup.validate(null);
- }).hasMessage("resultIn is marked @NonNull but is null");
+ }).hasMessageMatching("resultIn is marked .*ull but is null");
assertFalse(testJpaPdpSubGroup.validate(new PfValidationResult()).isOk());
assertTrue(testJpaPdpSubGroup.validate(new PfValidationResult()).toString()
*/
public class PdpProviderTest {
private static final String PDP_GROUPS0_JSON = "testdata/PdpGroups0.json";
- private static final String PDP_TYPE_IS_NULL = "pdpType is marked @NonNull but is null";
- private static final String SUBGROUP_IS_NULL = "pdpSubGroup is marked @NonNull but is null";
- private static final String GROUP_IS_NULL = "pdpGroupName is marked @NonNull but is null";
- private static final String DAO_IS_NULL = "dao is marked @NonNull but is null";
+ private static final String PDP_TYPE_IS_NULL = "pdpType is marked .*ull but is null";
+ private static final String SUBGROUP_IS_NULL = "pdpSubGroup is marked .*ull but is null";
+ private static final String GROUP_IS_NULL = "pdpGroupName is marked .*ull but is null";
+ private static final String DAO_IS_NULL = "dao is marked .*ull but is null";
private static final String PDP_GROUP0 = "PdpGroup0";
private PfDao pfDao;
private StandardCoder standardCoder;
public void testGroupsGet() throws Exception {
assertThatThrownBy(() -> {
new PdpProvider().getPdpGroups(null, null);
- }).hasMessage(DAO_IS_NULL);
+ }).hasMessageMatching(DAO_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().getPdpGroups(null, "name");
- }).hasMessage(DAO_IS_NULL);
+ }).hasMessageMatching(DAO_IS_NULL);
String originalJson = ResourceUtils.getResourceAsString(PDP_GROUPS0_JSON);
PdpGroups pdpGroups0 = standardCoder.decode(originalJson, PdpGroups.class);
public void testFilteredPdpGroupGet() throws Exception {
assertThatThrownBy(() -> {
new PdpProvider().getFilteredPdpGroups(null, null);
- }).hasMessage(DAO_IS_NULL);
+ }).hasMessageMatching(DAO_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().getFilteredPdpGroups(null, PdpGroupFilter.builder().build());
- }).hasMessage(DAO_IS_NULL);
+ }).hasMessageMatching(DAO_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().getFilteredPdpGroups(pfDao, null);
- }).hasMessage("filter is marked @NonNull but is null");
+ }).hasMessageMatching("filter is marked .*ull but is null");
String originalJson = ResourceUtils.getResourceAsString("testdata/PdpGroupsForFiltering.json");
PdpGroups pdpGroups0 = standardCoder.decode(originalJson, PdpGroups.class);
public void testGroupsCreate() throws Exception {
assertThatThrownBy(() -> {
new PdpProvider().createPdpGroups(null, null);
- }).hasMessage(DAO_IS_NULL);
+ }).hasMessageMatching(DAO_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().createPdpGroups(null, new ArrayList<>());
- }).hasMessage(DAO_IS_NULL);
+ }).hasMessageMatching(DAO_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().createPdpGroups(pfDao, null);
- }).hasMessage("pdpGroups is marked @NonNull but is null");
+ }).hasMessageMatching("pdpGroups is marked .*ull but is null");
String originalJson = ResourceUtils.getResourceAsString(PDP_GROUPS0_JSON);
PdpGroups pdpGroups0 = standardCoder.decode(originalJson, PdpGroups.class);
public void testGroupsUpdate() throws Exception {
assertThatThrownBy(() -> {
new PdpProvider().updatePdpGroups(null, null);
- }).hasMessage(DAO_IS_NULL);
+ }).hasMessageMatching(DAO_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().updatePdpGroups(null, new ArrayList<>());
- }).hasMessage(DAO_IS_NULL);
+ }).hasMessageMatching(DAO_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().updatePdpGroups(pfDao, null);
- }).hasMessage("pdpGroups is marked @NonNull but is null");
+ }).hasMessageMatching("pdpGroups is marked .*ull but is null");
String originalJson = ResourceUtils.getResourceAsString(PDP_GROUPS0_JSON);
PdpGroups pdpGroups0 = standardCoder.decode(originalJson, PdpGroups.class);
public void testPoliciesDelete() throws Exception {
assertThatThrownBy(() -> {
new PdpProvider().deletePdpGroup(null, null);
- }).hasMessage(DAO_IS_NULL);
+ }).hasMessageMatching(DAO_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().deletePdpGroup(null, "name");
- }).hasMessage(DAO_IS_NULL);
+ }).hasMessageMatching(DAO_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().deletePdpGroup(pfDao, null);
- }).hasMessage("name is marked @NonNull but is null");
+ }).hasMessageMatching("name is marked .*ull but is null");
assertThatThrownBy(() -> {
new PdpProvider().deletePdpGroup(pfDao, "name");
public void testPdpSubgroupUpdate() throws Exception {
assertThatThrownBy(() -> {
new PdpProvider().updatePdpSubGroup(null, null, null);
- }).hasMessage(DAO_IS_NULL);
+ }).hasMessageMatching(DAO_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().updatePdpSubGroup(null, null, new PdpSubGroup());
- }).hasMessage(DAO_IS_NULL);
+ }).hasMessageMatching(DAO_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().updatePdpSubGroup(null, "name", null);
- }).hasMessage(DAO_IS_NULL);
+ }).hasMessageMatching(DAO_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().updatePdpSubGroup(null, "name", new PdpSubGroup());
- }).hasMessage(DAO_IS_NULL);
+ }).hasMessageMatching(DAO_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().updatePdpSubGroup(pfDao, null, null);
- }).hasMessage(GROUP_IS_NULL);
+ }).hasMessageMatching(GROUP_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().updatePdpSubGroup(pfDao, null, new PdpSubGroup());
- }).hasMessage(GROUP_IS_NULL);
+ }).hasMessageMatching(GROUP_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().updatePdpSubGroup(pfDao, "name", null);
- }).hasMessage(SUBGROUP_IS_NULL);
+ }).hasMessageMatching(SUBGROUP_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().updatePdpSubGroup(pfDao, "name", new PdpSubGroup());
public void testPdpUpdate() throws Exception {
assertThatThrownBy(() -> {
new PdpProvider().updatePdp(null, null, null, null);
- }).hasMessage(DAO_IS_NULL);
+ }).hasMessageMatching(DAO_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().updatePdp(null, null, null, new Pdp());
- }).hasMessage(DAO_IS_NULL);
+ }).hasMessageMatching(DAO_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().updatePdp(null, null, "TYPE", null);
- }).hasMessage(DAO_IS_NULL);
+ }).hasMessageMatching(DAO_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().updatePdp(null, null, "TYPE", new Pdp());
- }).hasMessage(DAO_IS_NULL);
+ }).hasMessageMatching(DAO_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().updatePdp(null, "name", null, null);
- }).hasMessage(DAO_IS_NULL);
+ }).hasMessageMatching(DAO_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().updatePdp(null, "name", null, new Pdp());
- }).hasMessage(DAO_IS_NULL);
+ }).hasMessageMatching(DAO_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().updatePdp(null, "name", "TYPE", null);
- }).hasMessage(DAO_IS_NULL);
+ }).hasMessageMatching(DAO_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().updatePdp(null, "name", "TYPE", new Pdp());
- }).hasMessage(DAO_IS_NULL);
+ }).hasMessageMatching(DAO_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().updatePdp(pfDao, null, null, null);
- }).hasMessage(GROUP_IS_NULL);
+ }).hasMessageMatching(GROUP_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().updatePdp(pfDao, null, null, new Pdp());
- }).hasMessage(GROUP_IS_NULL);
+ }).hasMessageMatching(GROUP_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().updatePdp(pfDao, null, "TYPE", null);
- }).hasMessage(GROUP_IS_NULL);
+ }).hasMessageMatching(GROUP_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().updatePdp(pfDao, null, "TYPE", new Pdp());
- }).hasMessage(GROUP_IS_NULL);
+ }).hasMessageMatching(GROUP_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().updatePdp(pfDao, "name", null, null);
- }).hasMessage(SUBGROUP_IS_NULL);
+ }).hasMessageMatching(SUBGROUP_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().updatePdp(pfDao, "name", null, new Pdp());
- }).hasMessage(SUBGROUP_IS_NULL);
+ }).hasMessageMatching(SUBGROUP_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().updatePdp(pfDao, "name", "TYPE", null);
- }).hasMessage("pdp is marked @NonNull but is null");
+ }).hasMessageMatching("pdp is marked .*ull but is null");
assertThatThrownBy(() -> {
new PdpProvider().updatePdp(pfDao, "name", "TYPE", new Pdp());
public void testGetPdpStatistics() throws PfModelException {
assertThatThrownBy(() -> {
new PdpProvider().getPdpStatistics(null, null);
- }).hasMessage(DAO_IS_NULL);
+ }).hasMessageMatching(DAO_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().getPdpStatistics(null, "name");
- }).hasMessage(DAO_IS_NULL);
+ }).hasMessageMatching(DAO_IS_NULL);
assertEquals(0, new PdpProvider().getPdpStatistics(pfDao, "name").size());
}
public void testUpdatePdpStatistics() throws PfModelException {
assertThatThrownBy(() -> {
new PdpProvider().updatePdpStatistics(null, null, null, null, null);
- }).hasMessage(DAO_IS_NULL);
+ }).hasMessageMatching(DAO_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().updatePdpStatistics(null, null, null, null, new PdpStatistics());
- }).hasMessage(DAO_IS_NULL);
+ }).hasMessageMatching(DAO_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().updatePdpStatistics(null, null, null, "inst", null);
- }).hasMessage(DAO_IS_NULL);
+ }).hasMessageMatching(DAO_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().updatePdpStatistics(null, null, null, "inst", new PdpStatistics());
- }).hasMessage(DAO_IS_NULL);
+ }).hasMessageMatching(DAO_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().updatePdpStatistics(null, null, "TYPE", null, null);
- }).hasMessage(DAO_IS_NULL);
+ }).hasMessageMatching(DAO_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().updatePdpStatistics(null, null, "TYPE", null, new PdpStatistics());
- }).hasMessage(DAO_IS_NULL);
+ }).hasMessageMatching(DAO_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().updatePdpStatistics(null, null, "TYPE", "inst", null);
- }).hasMessage(DAO_IS_NULL);
+ }).hasMessageMatching(DAO_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().updatePdpStatistics(null, null, "TYPE", "inst", new PdpStatistics());
- }).hasMessage(DAO_IS_NULL);
+ }).hasMessageMatching(DAO_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().updatePdpStatistics(null, "name", null, null, null);
- }).hasMessage(DAO_IS_NULL);
+ }).hasMessageMatching(DAO_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().updatePdpStatistics(null, "name", null, null, new PdpStatistics());
- }).hasMessage(DAO_IS_NULL);
+ }).hasMessageMatching(DAO_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().updatePdpStatistics(null, "name", null, "inst", null);
- }).hasMessage(DAO_IS_NULL);
+ }).hasMessageMatching(DAO_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().updatePdpStatistics(null, "name", null, "inst", new PdpStatistics());
- }).hasMessage(DAO_IS_NULL);
+ }).hasMessageMatching(DAO_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().updatePdpStatistics(null, "name", "TYPE", null, null);
- }).hasMessage(DAO_IS_NULL);
+ }).hasMessageMatching(DAO_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().updatePdpStatistics(null, "name", "TYPE", null, new PdpStatistics());
- }).hasMessage(DAO_IS_NULL);
+ }).hasMessageMatching(DAO_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().updatePdpStatistics(null, "name", "TYPE", "inst", null);
- }).hasMessage(DAO_IS_NULL);
+ }).hasMessageMatching(DAO_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().updatePdpStatistics(null, "name", "TYPE", "inst", new PdpStatistics());
- }).hasMessage(DAO_IS_NULL);
+ }).hasMessageMatching(DAO_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().updatePdpStatistics(pfDao, null, null, null, null);
- }).hasMessage(GROUP_IS_NULL);
+ }).hasMessageMatching(GROUP_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().updatePdpStatistics(pfDao, null, null, null, new PdpStatistics());
- }).hasMessage(GROUP_IS_NULL);
+ }).hasMessageMatching(GROUP_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().updatePdpStatistics(pfDao, null, null, "inst", null);
- }).hasMessage(GROUP_IS_NULL);
+ }).hasMessageMatching(GROUP_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().updatePdpStatistics(pfDao, null, null, "inst", new PdpStatistics());
- }).hasMessage(GROUP_IS_NULL);
+ }).hasMessageMatching(GROUP_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().updatePdpStatistics(pfDao, null, "TYPE", null, null);
- }).hasMessage(GROUP_IS_NULL);
+ }).hasMessageMatching(GROUP_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().updatePdpStatistics(pfDao, null, "TYPE", null, new PdpStatistics());
- }).hasMessage(GROUP_IS_NULL);
+ }).hasMessageMatching(GROUP_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().updatePdpStatistics(pfDao, null, "TYPE", "inst", null);
- }).hasMessage(GROUP_IS_NULL);
+ }).hasMessageMatching(GROUP_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().updatePdpStatistics(pfDao, null, "TYPE", "inst", new PdpStatistics());
- }).hasMessage(GROUP_IS_NULL);
+ }).hasMessageMatching(GROUP_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().updatePdpStatistics(pfDao, "name", null, null, null);
- }).hasMessage(PDP_TYPE_IS_NULL);
+ }).hasMessageMatching(PDP_TYPE_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().updatePdpStatistics(pfDao, "name", null, null, new PdpStatistics());
- }).hasMessage(PDP_TYPE_IS_NULL);
+ }).hasMessageMatching(PDP_TYPE_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().updatePdpStatistics(pfDao, "name", null, "inst", null);
- }).hasMessage(PDP_TYPE_IS_NULL);
+ }).hasMessageMatching(PDP_TYPE_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().updatePdpStatistics(pfDao, "name", null, "inst", new PdpStatistics());
- }).hasMessage(PDP_TYPE_IS_NULL);
+ }).hasMessageMatching(PDP_TYPE_IS_NULL);
assertThatThrownBy(() -> {
new PdpProvider().updatePdpStatistics(pfDao, "name", "TYPE", null, null);
- }).hasMessage("pdpInstanceId is marked @NonNull but is null");
+ }).hasMessageMatching("pdpInstanceId is marked .*ull but is null");
assertThatThrownBy(() -> {
new PdpProvider().updatePdpStatistics(pfDao, "name", "TYPE", null, new PdpStatistics());
- }).hasMessage("pdpInstanceId is marked @NonNull but is null");
+ }).hasMessageMatching("pdpInstanceId is marked .*ull but is null");
assertThatThrownBy(() -> {
new PdpProvider().updatePdpStatistics(pfDao, "name", "TYPE", "inst", null);
- }).hasMessage("pdpStatistics is marked @NonNull but is null");
+ }).hasMessageMatching("pdpStatistics is marked .*ull but is null");
new PdpProvider().updatePdpStatistics(pfDao, "name", "TYPE", "inst", new PdpStatistics());
}