diff options
author | Pamela Dragosh <pdragosh@research.att.com> | 2018-04-03 12:32:48 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-04-03 12:32:48 +0000 |
commit | def1c29d8a8c4372e006b1388a456bca92d57500 (patch) | |
tree | ae973c41a0fe48a2afc90dcae431598b34583a62 /ONAP-SDK-APP | |
parent | 145ef110e6ee7108846c91a509e33e65b5b64306 (diff) | |
parent | b0b4b6397de13ac296ab82ed40df75fdf5846d83 (diff) |
Merge "JUnit additions for PDP,PDP-REST,SDK,XACML"
Diffstat (limited to 'ONAP-SDK-APP')
-rw-r--r-- | ONAP-SDK-APP/src/test/java/org/onap/portalapp/scheduler/RegisterTest.java | 59 |
1 files changed, 34 insertions, 25 deletions
diff --git a/ONAP-SDK-APP/src/test/java/org/onap/portalapp/scheduler/RegisterTest.java b/ONAP-SDK-APP/src/test/java/org/onap/portalapp/scheduler/RegisterTest.java index ec7724c07..0f406b163 100644 --- a/ONAP-SDK-APP/src/test/java/org/onap/portalapp/scheduler/RegisterTest.java +++ b/ONAP-SDK-APP/src/test/java/org/onap/portalapp/scheduler/RegisterTest.java @@ -22,36 +22,45 @@ package org.onap.portalapp.scheduler; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; + import java.util.ArrayList; import java.util.List; -import org.junit.Rule; + import org.junit.Test; -import org.junit.rules.ExpectedException; import org.quartz.Trigger; import org.quartz.TriggerBuilder; public class RegisterTest { - @Rule - public final ExpectedException thrown = ExpectedException.none(); - - @Test - public void testRegister() { - Register register = new Register(); - TriggerBuilder<Trigger> triggerBuilder = TriggerBuilder.newTrigger(); - Trigger trigger = triggerBuilder.build(); - List<Trigger> triggers = new ArrayList<Trigger>(); - triggers.add(trigger); - - register.setScheduleTriggers(triggers); - assertEquals(register.getScheduleTriggers(), triggers); - assertEquals(register.getTriggers().length, 1); - } - - @Test - public void testRegisterNegativeCase() { - thrown.expect(NullPointerException.class); - Register register = new Register(); - register.registerTriggers(); - fail("Expecting an exception."); - } + @Test + public void testRegister() { + Register register = new Register(); + TriggerBuilder<Trigger> triggerBuilder = TriggerBuilder.newTrigger(); + Trigger trigger = triggerBuilder.build(); + List<Trigger> triggers = new ArrayList<Trigger>(); + triggers.add(trigger); + + register.setScheduleTriggers(triggers); + assertEquals(register.getScheduleTriggers(), triggers); + assertEquals(register.getTriggers().length, 1); + } + + @Test(expected = NullPointerException.class) + public void testRegisterNegativeCase() { + Register register = new Register(); + register.registerTriggers(); + fail("Expecting an exception."); + } + + @Test(expected = NullPointerException.class) + public void testRegisterNegativeCase2() { + // Setup test data + String value = "testVal"; + Register register = new Register(); + List<Trigger> triggers = new ArrayList<Trigger>(); + register.setScheduleTriggers(triggers); + + // Test register + register.registerTriggers(); + fail("Expecting an exception."); + } } |