From 64d7ded68eff8bad00d2a379e23b7a8118224c23 Mon Sep 17 00:00:00 2001 From: asgar Date: Tue, 25 Sep 2018 21:36:19 +0530 Subject: added some more test cases ValidatorUtilTest.java Change-Id: Ia7a240aad73eff0c6d9944f845125677e6e5611b Issue-ID: DMAAP-809 Signed-off-by: Mohamed Asgar Samiulla --- .../com/att/nsa/mr/tools/ValidatorUtilTest.java | 79 ++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/src/test/java/com/att/nsa/mr/tools/ValidatorUtilTest.java b/src/test/java/com/att/nsa/mr/tools/ValidatorUtilTest.java index baec4d8..9317375 100644 --- a/src/test/java/com/att/nsa/mr/tools/ValidatorUtilTest.java +++ b/src/test/java/com/att/nsa/mr/tools/ValidatorUtilTest.java @@ -89,4 +89,83 @@ public class ValidatorUtilTest { } } + + + + + @Test + public void testValidateForNonDME2WithNullServiceName() { + Properties props = new Properties(); + props.setProperty("TransportType", ProtocolTypeConstants.AUTH_KEY.getValue()); + try{ + ValidatorUtil.validatePublisher(props); + } catch(IllegalArgumentException e) { + assertEquals(e.getMessage(), "Servicename is needed"); + } + + } + + @Test + public void testValidateForNonDME2WithNullTopic() { + Properties props = new Properties(); + props.setProperty("TransportType", ProtocolTypeConstants.AUTH_KEY.getValue()); + props.setProperty("host", "ServiceName"); + try{ + ValidatorUtil.validatePublisher(props); + } catch(IllegalArgumentException e) { + assertEquals(e.getMessage(), "topic is needed"); + } + + } + + @Test + public void testValidateForNonDME2WithNullContenttype() { + Properties props = new Properties(); + props.setProperty("TransportType", ProtocolTypeConstants.AUTH_KEY.getValue()); + props.setProperty("host", "ServiceName"); + props.setProperty("topic", "topic"); + try{ + ValidatorUtil.validatePublisher(props); + } catch(IllegalArgumentException e) { + assertEquals(e.getMessage(), "contenttype is needed"); + } + + } + + + @Test + public void testValidateForNonDME2WithNullUserName() { + Properties props = new Properties(); + props.setProperty("TransportType", ProtocolTypeConstants.AUTH_KEY.getValue()); + props.setProperty("host", "ServiceName"); + props.setProperty("topic", "topic"); + props.setProperty("contenttype", "contenttype"); + try{ + ValidatorUtil.validatePublisher(props); + } catch(IllegalArgumentException e) { + assertEquals(e.getMessage(), "username is needed"); + } + + } + + @Test + public void testValidateForNonDME2WithNullPassword() { + Properties props = new Properties(); + props.setProperty("TransportType", ProtocolTypeConstants.AUTH_KEY.getValue()); + props.setProperty("host", "ServiceName"); + props.setProperty("topic", "topic"); + props.setProperty("username", "username"); + props.setProperty("contenttype", "contenttype"); + + try{ + ValidatorUtil.validatePublisher(props); + } catch(IllegalArgumentException e) { + assertEquals(e.getMessage(), "password is needed"); + } + + } + + + + } -- cgit 1.2.3-korg