diff options
author | asgar <sammoham@in.ibm.com> | 2018-09-25 21:36:19 +0530 |
---|---|---|
committer | asgar <sammoham@in.ibm.com> | 2018-09-25 21:36:27 +0530 |
commit | 64d7ded68eff8bad00d2a379e23b7a8118224c23 (patch) | |
tree | fb10f22ee67626ce3b86fb09aeb7bcc9acdcca51 | |
parent | c93fe4ad252a0e74fc5cf1f4d6c31702e8cbe62d (diff) |
added some more test cases ValidatorUtilTest.java
Change-Id: Ia7a240aad73eff0c6d9944f845125677e6e5611b
Issue-ID: DMAAP-809
Signed-off-by: Mohamed Asgar Samiulla <sammoham@in.ibm.com>
-rw-r--r-- | src/test/java/com/att/nsa/mr/tools/ValidatorUtilTest.java | 79 |
1 files changed, 79 insertions, 0 deletions
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"); + } + + } + + + + } |