+
+ @Test
+ public void testValidateEmptyRestServer() throws CoderException {
+ SimulatorParameters params = new StandardCoder()
+ .decode(new File("src/test/resources/emptyRestServer.json"), SimulatorParameters.class);
+ assertNull(params.validate("ValidParams").getResult());
+ }
+
+ @Test
+ public void testValidateInvalidDmaapProvider() throws CoderException {
+ SimulatorParameters params = new StandardCoder()
+ .decode(new File("src/test/resources/invalidDmaapProvider.json"), SimulatorParameters.class);
+ BeanValidationResult result = params.validate("InvalidDmaapParams");
+ assertFalse(result.isValid());
+ assertNotNull(result.getResult());
+ }
+
+ @Test
+ public void testValidateInvalidDmaapName() throws CoderException {
+ SimulatorParameters params = new StandardCoder().decode(
+ new File("src/test/resources/invalidDmaapName.json"), SimulatorParameters.class);
+ BeanValidationResult result = params.validate("InvalidDmaapParams");
+ assertFalse(result.isValid());
+ assertThat(result.getResult()).contains("item \"name\" value \"null\"");
+ }
+
+ @Test
+ public void testValidateInvalidTopicSweep() throws CoderException {
+ SimulatorParameters params = new StandardCoder().decode(
+ new File("src/test/resources/invalidTopicSweep.json"), SimulatorParameters.class);
+ BeanValidationResult result = params.validate("InvalidDmaapParams");
+ assertFalse(result.isValid());
+ assertThat(result.getResult()).contains("topicSweepSec");
+ }
+
+ @Test
+ public void testValidateInvalidGrpcServer() throws CoderException {
+ SimulatorParameters params = new StandardCoder()
+ .decode(new File("src/test/resources/invalidGrpcServer.json"), SimulatorParameters.class);
+ BeanValidationResult result = params.validate("InvalidGrpcParams");
+ assertFalse(result.isValid());
+ assertNotNull(result.getResult());
+ }