try {
org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");
NamingContext ncRef = NamingContextHelper.narrow(objRef);
NameComponent nc = new NameComponent(serviceName, "");
NameComponent path[] = {nc};
ScenarioOne so = ScenarioOneHelper.narrow(ncRef.resolve(path));
RichStruct richStruct = getRichStruct();
RichStruct result = so.setRichStruct(richStruct);
assertTrue(equalTo(result, richStruct));
try {
richStruct.innerStruct.color = Color.red;
result = so.setRichStruct(richStruct);
fail();
} catch (Exception e) {
assertTrue(e instanceof WrongColor);
}
try {
richStruct.innerStruct.color = Color.green;
richStruct.longField = 0;
result = so.setRichStruct(richStruct);
fail();
} catch (Exception e) {
assertTrue(e instanceof UnexpectedException);
}