/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 Nordix Foundation.
+ * 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 static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
*/
public class JpaToscaEventFilterTest {
- private static final String KEY_IS_NULL = "key is marked @NonNull but is null";
+ private static final String KEY_IS_NULL = "key is marked .*on.*ull but is null";
private static final String A_REQUREMENT = "A Requrement";
private static final String A_CAPABILITY = "A Capability";
private static final String VERSION_001 = "0.0.1";
assertNotNull(new JpaToscaEventFilter(new PfReferenceKey(), new PfConceptKey()));
assertNotNull(new JpaToscaEventFilter(new JpaToscaEventFilter()));
- assertThatThrownBy(() -> new JpaToscaEventFilter((PfReferenceKey) null)).hasMessage(KEY_IS_NULL);
+ assertThatThrownBy(() -> new JpaToscaEventFilter((PfReferenceKey) null)).hasMessageMatching(KEY_IS_NULL);
- assertThatThrownBy(() -> new JpaToscaEventFilter(null, null)).hasMessage(KEY_IS_NULL);
+ assertThatThrownBy(() -> new JpaToscaEventFilter(null, null)).hasMessageMatching(KEY_IS_NULL);
- assertThatThrownBy(() -> new JpaToscaEventFilter(null, new PfConceptKey())).hasMessage(KEY_IS_NULL);
+ assertThatThrownBy(() -> new JpaToscaEventFilter(null, new PfConceptKey())).hasMessageMatching(KEY_IS_NULL);
assertThatThrownBy(() -> new JpaToscaEventFilter(new PfReferenceKey(), null))
- .hasMessage("node is marked @NonNull but is null");
+ .hasMessageMatching("node is marked .*on.*ull but is null");
assertThatThrownBy(() -> new JpaToscaEventFilter((JpaToscaEventFilter) null))
- .hasMessage("copyConcept is marked @NonNull but is null");
+ .isInstanceOf(NullPointerException.class);
PfConceptKey efParentKey = new PfConceptKey("tParentKey", VERSION_001);
PfReferenceKey efKey = new PfReferenceKey(efParentKey, "trigger0");
assertEquals(tef, tdtClone0);
assertEquals(0, tef.compareTo(tdtClone0));
- JpaToscaEventFilter tdtClone1 = new JpaToscaEventFilter();
- tef.copyTo(tdtClone1);
+ JpaToscaEventFilter tdtClone1 = new JpaToscaEventFilter(tef);
assertEquals(tef, tdtClone1);
assertEquals(0, tef.compareTo(tdtClone1));
assertEquals(-1, tef.compareTo(null));
assertEquals(0, tef.compareTo(tef));
- assertFalse(tef.compareTo(tef.getKey()) == 0);
+ assertNotEquals(0, tef.compareTo(tef.getKey()));
PfReferenceKey otherDtKey = new PfReferenceKey("otherDt", VERSION_001, "OtherEventFilter");
JpaToscaEventFilter otherDt = new JpaToscaEventFilter(otherDtKey);
- assertFalse(tef.compareTo(otherDt) == 0);
+ assertNotEquals(0, tef.compareTo(otherDt));
otherDt.setKey(efKey);
- assertFalse(tef.compareTo(otherDt) == 0);
+ assertNotEquals(0, tef.compareTo(otherDt));
otherDt.setNode(nodeKey);
- assertFalse(tef.compareTo(otherDt) == 0);
+ assertNotEquals(0, tef.compareTo(otherDt));
otherDt.setRequirement(A_REQUREMENT);
- assertFalse(tef.compareTo(otherDt) == 0);
+ assertNotEquals(0, tef.compareTo(otherDt));
otherDt.setCapability(A_CAPABILITY);
assertEquals(0, tef.compareTo(otherDt));
- assertThatThrownBy(() -> tef.copyTo(null)).hasMessage("target is marked @NonNull but is null");
-
assertEquals(2, tef.getKeys().size());
assertEquals(2, new JpaToscaEventFilter().getKeys().size());
tef.setNode(nodeKey);
assertTrue(tef.validate(new PfValidationResult()).isValid());
- assertThatThrownBy(() -> tef.validate(null)).hasMessage("resultIn is marked @NonNull but is null");
+ assertThatThrownBy(() -> tef.validate(null)).hasMessageMatching("resultIn is marked .*on.*ull but is null");
}
}