val rpcMeta = metadata.getRpcMethod(name);
val bodyTmp = '''
{
+ if($1 == null) {
+ throw new IllegalArgumentException("RPC input must not be null and must contain a value for field «rpcMeta.inputRouteGetter.name»");
+ }
+ if($1.«rpcMeta.inputRouteGetter.name»() == null) {
+ throw new IllegalArgumentException("Field «rpcMeta.inputRouteGetter.name» must not be null");
+ }
final «InstanceIdentifier.name» identifier = $1.«rpcMeta.inputRouteGetter.name»()«IF rpcMeta.
routeEncapsulated».getValue()«ENDIF»;
«supertype.name» instance = («supertype.name») «rpcMeta.context.routingTableField».get(identifier);
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;
// 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) {