this.added = added;
this.deleted = deleted;
}
+
+ /**
+ * Determines if the notification is empty (i.e., has no added or delete policy
+ * notifications).
+ *
+ * @return {@code true} if the notification is empty, {@code false} otherwise
+ */
+ public boolean isEmpty() {
+ return (added.isEmpty() && deleted.isEmpty());
+ }
}
package org.onap.policy.models.pap.concepts;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
import org.junit.Test;
import org.onap.policy.common.utils.coder.CoderException;
// test equals() method (and verify encode/decode worked)
assertEquals(notify, notify2);
+
+ /*
+ * Test isEmpty()
+ */
+ assertFalse(notify.isEmpty());
+ assertFalse(notify2.isEmpty());
+ assertTrue(new PolicyNotification().isEmpty());
+ assertFalse(new PolicyNotification(add, Collections.emptyList()).isEmpty());
+ assertFalse(new PolicyNotification(Collections.emptyList(), del).isEmpty());
}
}