X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-binding-broker%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fbinding%2Ftest%2FRuntimeCodeGeneratorTest.java;h=9ba65339710b50c5e3a1e453fa5b5ff3805484f3;hb=2f6b6ce8abca0cf38c857900bf5a84183ef5e9dc;hp=e6cd1aa1ad638716b474fa9570c7d3ace3d767a1;hpb=e8b8890b47b54a15de876ab63f41bae6eac61120;p=controller.git diff --git a/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/RuntimeCodeGeneratorTest.java b/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/RuntimeCodeGeneratorTest.java index e6cd1aa1ad..9ba6533971 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/RuntimeCodeGeneratorTest.java +++ b/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/RuntimeCodeGeneratorTest.java @@ -10,6 +10,7 @@ package org.opendaylight.controller.sal.binding.test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertSame; +import static org.junit.Assert.fail; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; @@ -154,6 +155,31 @@ public class RuntimeCodeGeneratorTest { // We should have call to instance 1 verify(service[1]).simple(instance_1_input[0]); + + /* + * Generated RPC service should throw illegalArgumentException + * with message if rpc input is null. + */ + try { + product.getInvocationProxy().simple(null); + fail("Generated RPC router should throw IllegalArgumentException on null input"); + } catch (IllegalArgumentException e){ + assertNotNull(e.getMessage()); + } + + + /* + * Generated RPC service should throw illegalArgumentException + * with message if rpc route is null. + */ + try { + SimpleInput withoutValue = new SimpleInputImpl(null); + product.getInvocationProxy().simple(withoutValue); + fail("Generated RPC router should throw IllegalArgumentException on null value for route"); + } catch (IllegalArgumentException e){ + assertNotNull(e.getMessage()); + } + } private InstanceIdentifier[][] identifiers(final int serviceSize, final int instancesPerService) {