use of org.eclipse.milo.opcua.sdk.client.methods.UaMethodException in project milo by eclipse.
the class AbstractMethodInvocationHandlerTest method implementationCanValidateArguments.
@Test
public void implementationCanValidateArguments() throws UaException {
AddressSpace addressSpace = client.getAddressSpace();
UaObjectNode objectsNode = addressSpace.getObjectNode(Identifiers.ObjectsFolder);
try {
objectsNode.callMethod(new QualifiedName(2, "onlyAcceptsPositiveInputs()"), new Variant[] { new Variant(-1) });
} catch (UaMethodException e) {
System.out.println("result: " + e.getStatusCode());
System.out.println("inputArgumentResults: " + Arrays.toString(e.getInputArgumentResults()));
assertEquals(StatusCodes.Bad_InvalidArgument, e.getStatusCode().getValue());
assertEquals(StatusCodes.Bad_OutOfRange, e.getInputArgumentResults()[0].getValue());
}
}
Aggregations