### Question:
CorbaConduit implements Conduit { public void buildRequest(CorbaMessage message, OperationType opType) throws Exception { ServiceInfo service = message.getExchange().getEndpoint().getEndpointInfo().getService(); NVList nvlist = getArguments(message); NamedValue ret = getReturn(message); Map<TypeCode, RaisesType> exceptions = getOperationExceptions(opType, typeMap); ExceptionList exList = getExceptionList(exceptions, message, opType); Request request = getRequest(message, opType.getName(), nvlist, ret, exList); if (request == null) { throw new CorbaBindingException("Couldn't build the corba request"); } Exception ex = null; try { request.invoke(); ex = request.env().exception(); } catch (SystemException sysex) { ex = sysex; } if (ex != null) { if (ex instanceof SystemException) { message.setContent(Exception.class, new Fault(ex)); message.setSystemException((SystemException) ex); return; } if (ex instanceof UnknownUserException) { UnknownUserException userEx = (UnknownUserException) ex; Any except = userEx.except; RaisesType raises = exceptions.get(except.type()); if (raises == null) { throw new CorbaBindingException("Couldn't find the exception type code to unmarshall"); } QName elName = new QName("", raises.getException().getLocalPart()); CorbaObjectHandler handler = CorbaHandlerUtils.initializeObjectHandler(orb, elName, raises.getException(), typeMap, service); CorbaStreamable exStreamable = message.createStreamableObject(handler, elName); exStreamable._read(except.create_input_stream()); message.setStreamableException(exStreamable); message.setContent(Exception.class, new Fault(userEx)); } else { message.setContent(Exception.class, new Fault(ex)); } } } CorbaConduit(EndpointInfo ei, EndpointReferenceType ref, OrbConfig config); OrbConfig getOrbConfig(); synchronized void prepareOrb(); void prepare(Message message); void close(Message message); EndpointReferenceType getTarget(); void close(); void setMessageObserver(MessageObserver observer); final EndpointReferenceType getTargetReference(EndpointReferenceType t); final String getAddress(); void buildRequest(CorbaMessage message, OperationType opType); NVList getArguments(CorbaMessage message); NamedValue getReturn(CorbaMessage message); ExceptionList getExceptionList(Map<TypeCode, RaisesType> exceptions,
                                             CorbaMessage message,
                                             OperationType opType); Request getRequest(CorbaMessage message,
                                 String opName,
                                 org.omg.CORBA.NVList nvlist,
                                 org.omg.CORBA.NamedValue ret,
                                 org.omg.CORBA.ExceptionList exList); Map<TypeCode, RaisesType> getOperationExceptions(
                                         OperationType operation,
                                         CorbaTypeMap map); MessageObserver getMessageObserver();  }### Answer:
@Test public void testBuildRequest() throws Exception { CorbaConduit conduit = setupCorbaConduit(false); CorbaMessage message = control.createMock(CorbaMessage.class); Exchange exchange = control.createMock(Exchange.class); EasyMock.expect(message.getExchange()); EasyMock.expectLastCall().andReturn(exchange); ServiceInfo service = control.createMock(ServiceInfo.class); EasyMock.expect(exchange.get(ServiceInfo.class)).andReturn(service); List<CorbaTypeMap> list = control.createMock(List.class); CorbaTypeMap typeMap = control.createMock(CorbaTypeMap.class); EasyMock.expect(service.getExtensors(CorbaTypeMap.class)).andReturn(list); OperationType opType = control.createMock(OperationType.class); conduit.getArguments(message); EasyMock.expectLastCall().andReturn(null); conduit.getReturn(message); EasyMock.expectLastCall().andReturn(null); conduit.getExceptionList(conduit.getOperationExceptions(opType, typeMap), message, opType); EasyMock.expectLastCall().andReturn(null); conduit.getRequest(message, "Hello", null, null, null); EasyMock.expectLastCall(); }