Skip to content

Commit c49b06c

Browse files
A S Adil MohammadA S Adil Mohammad
authored andcommitted
Adding a failure case for the test
Signed-off-by: A S Adil Mohammad <asadilmohammad2020@gmail.com>
1 parent 8dfef64 commit c49b06c

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/integration/java/com/ibm/eventstreams/connect/mqsink/MQSinkTaskIT.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,13 @@ public void verifyStringMessages() throws JMSException {
131131
public void verifyCipherMappingsConfig() throws JMSException {
132132
final MQSinkTask newConnectTask = new MQSinkTask();
133133

134-
// configure a sink task for string messages
134+
// configure a sink task for validating config
135135
final Map<String, String> connectorConfigProps = createDefaultConnectorProperties();
136136
connectorConfigProps.put("mq.message.builder",
137137
DEFAULT_MESSAGE_BUILDER);
138138

139139
connectorConfigProps.put("mq.ssl.use.ibm.cipher.mappings",
140-
"true");
140+
"true");
141141

142142
// start the task so that it connects to MQ
143143
newConnectTask.start(connectorConfigProps);
@@ -148,6 +148,19 @@ public void verifyCipherMappingsConfig() throws JMSException {
148148

149149
// stop the task
150150
newConnectTask.stop();
151+
152+
// configure a sink task for validating config for failure case
153+
connectorConfigProps.put("mq.message.builder",
154+
DEFAULT_MESSAGE_BUILDER);
155+
156+
connectorConfigProps.put("mq.ssl.use.ibm.cipher.mappings",
157+
"hello");
158+
159+
// Verify the exception messages
160+
final ConfigException exc = assertThrows(ConfigException.class, () -> {
161+
newConnectTask.start(connectorConfigProps);
162+
});
163+
assertEquals("Invalid value hello for configuration mq.ssl.use.ibm.cipher.mappings: Expected value to be either true or false", exc.getMessage());
151164
}
152165

153166
@Test

0 commit comments

Comments
 (0)