From b0b4b6397de13ac296ab82ed40df75fdf5846d83 Mon Sep 17 00:00:00 2001 From: bobbymander Date: Mon, 2 Apr 2018 14:35:37 -0400 Subject: JUnit additions for PDP,PDP-REST,SDK,XACML Issue-ID: POLICY-600 Change-Id: I8052451c3f66116f361f2963fcc2727c022dd4d9 Signed-off-by: bobbymander --- .../org/onap/portalapp/scheduler/RegisterTest.java | 59 +++++++++++++--------- 1 file changed, 34 insertions(+), 25 deletions(-) (limited to 'ONAP-SDK-APP/src/test/java/org/onap/portalapp') 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 triggerBuilder = TriggerBuilder.newTrigger(); - Trigger trigger = triggerBuilder.build(); - List triggers = new ArrayList(); - 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 triggerBuilder = TriggerBuilder.newTrigger(); + Trigger trigger = triggerBuilder.build(); + List triggers = new ArrayList(); + 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 triggers = new ArrayList(); + register.setScheduleTriggers(triggers); + + // Test register + register.registerTriggers(); + fail("Expecting an exception."); + } } -- cgit 1.2.3-korg