diff options
author | bobbymander <bobby.mander@att.com> | 2018-04-02 14:35:37 -0400 |
---|---|---|
committer | bobbymander <bobby.mander@att.com> | 2018-04-02 15:47:02 -0400 |
commit | b0b4b6397de13ac296ab82ed40df75fdf5846d83 (patch) | |
tree | 1c7027d69f8de1663a7c20db4fc7731f4e7ec76a /ONAP-SDK-APP | |
parent | 26360c30af5ad955765ae0c3cb5bf2bfcf143669 (diff) |
JUnit additions for PDP,PDP-REST,SDK,XACML
Issue-ID: POLICY-600
Change-Id: I8052451c3f66116f361f2963fcc2727c022dd4d9
Signed-off-by: bobbymander <bobby.mander@att.com>
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."); + } } |