/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
-
import org.junit.Test;
import org.onap.policy.models.base.PfConceptKey;
import org.onap.policy.models.base.PfReferenceKey;
*/
public class JpaPdpGroupTest {
- private static final String NULL_KEY_ERROR = "key is marked @NonNull but is null";
+ private static final String NULL_ERROR = " is marked .*ull but is null";
+ private static final String NULL_KEY_ERROR = "key" + NULL_ERROR;
private static final String PDP_GROUP0 = "PDPGroup0";
private static final String VERSION = "1.0.0";
public void testJpaPdpGroup() {
assertThatThrownBy(() -> {
new JpaPdpGroup((JpaPdpGroup) null);
- }).hasMessage("copyConcept is marked @NonNull but is null");
+ }).hasMessageMatching("copyConcept" + NULL_ERROR);
assertThatThrownBy(() -> {
new JpaPdpGroup((PfConceptKey) null);
- }).hasMessage(NULL_KEY_ERROR);
+ }).hasMessageMatching(NULL_KEY_ERROR);
assertThatThrownBy(() -> {
new JpaPdpGroup((PdpGroup) null);
- }).hasMessage("authorativeConcept is marked @NonNull but is null");
+ }).hasMessageMatching("authorativeConcept" + NULL_ERROR);
assertThatThrownBy(() -> {
new JpaPdpGroup((JpaPdpGroup) null);
- }).hasMessage("copyConcept is marked @NonNull but is null");
+ }).hasMessageMatching("copyConcept" + NULL_ERROR);
assertThatThrownBy(() -> {
new JpaPdpGroup(null, null, null);
- }).hasMessage(NULL_KEY_ERROR);
+ }).hasMessageMatching(NULL_KEY_ERROR);
assertThatThrownBy(() -> {
new JpaPdpGroup(new PfConceptKey(), null, null);
- }).hasMessage("pdpGroupState is marked @NonNull but is null");
+ }).hasMessageMatching("pdpGroupState" + NULL_ERROR);
assertThatThrownBy(() -> {
new JpaPdpGroup(new PfConceptKey(), PdpState.PASSIVE, null);
- }).hasMessage("pdpSubGroups is marked @NonNull but is null");
+ }).hasMessageMatching("pdpSubGroups" + NULL_ERROR);
assertThatThrownBy(() -> {
new JpaPdpGroup(null, PdpState.PASSIVE, null);
- }).hasMessage(NULL_KEY_ERROR);
+ }).hasMessageMatching(NULL_KEY_ERROR);
assertThatThrownBy(() -> {
new JpaPdpGroup(null, PdpState.PASSIVE, new ArrayList<>());
- }).hasMessage(NULL_KEY_ERROR);
+ }).hasMessageMatching(NULL_KEY_ERROR);
assertThatThrownBy(() -> {
new JpaPdpGroup(null, null, new ArrayList<>());
- }).hasMessage(NULL_KEY_ERROR);
+ }).hasMessageMatching(NULL_KEY_ERROR);
assertNotNull(new JpaPdpGroup((new PfConceptKey())));
assertNotNull(new JpaPdpGroup((new JpaPdpGroup())));
assertThatThrownBy(() -> {
testJpaPdpGroup.fromAuthorative(null);
- }).hasMessage("pdpGroup is marked @NonNull but is null");
+ }).hasMessageMatching("pdpGroup" + NULL_ERROR);
testJpaPdpGroup.setKey(new PfConceptKey(PDP_GROUP0, VERSION));
testJpaPdpGroup.fromAuthorative(testPdpGroup);
assertThatThrownBy(() -> {
testJpaPdpGroup.validate(null);
- }).hasMessage("resultIn is marked @NonNull but is null");
+ }).hasMessageMatching("resultIn" + NULL_ERROR);
assertFalse(testJpaPdpGroup.validate(new PfValidationResult()).isOk());
testJpaPdpGroup.setPdpGroupState(PdpState.PASSIVE);
assertEquals(0, testJpaPdpGroup.compareTo(otherJpaPdpGroup));
assertEquals(-1, testJpaPdpGroup.compareTo(null));
assertEquals(0, testJpaPdpGroup.compareTo(testJpaPdpGroup));
- assertFalse(testJpaPdpGroup.compareTo(new DummyJpaPdpSubgroupChild()) == 0);
+ assertNotEquals(0, testJpaPdpGroup.compareTo(new DummyJpaPdpSubgroupChild()));
testJpaPdpGroup.getKey().setName("OtherName");
assertEquals(-1, testJpaPdpGroup.compareTo(otherJpaPdpGroup));