diff options
Diffstat (limited to 'ONAP-SDK-APP/src/test/java')
-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."); + } } |