### Question:
NMROperationInInterceptor extends AbstractPhaseInterceptor<NMRMessage> { public void handleMessage(NMRMessage message) throws Fault { Exchange ex = message.getExchange(); Endpoint ep = ex.get(Endpoint.class); BindingOperationInfo boi = ex.get(BindingOperationInfo.class); if (boi == null && message.getNmrExchange()!= null && message.getNmrExchange().getOperation() != null) { BindingInfo service = ep.getEndpointInfo().getBinding(); boi = getBindingOperationInfo(service, message.getNmrExchange().getOperation()); if (boi == null) { throw new Fault(new Message("UNKNOWN_OPERATION", BUNDLE, message.getNmrExchange().getOperation().toString())); } ex.put(BindingOperationInfo.class, boi); ex.put(OperationInfo.class, boi.getOperationInfo()); ex.setOneWay(boi.getOperationInfo().isOneWay()); message.put(MessageInfo.class, boi.getInput().getMessageInfo()); } } NMROperationInInterceptor(); void handleMessage(NMRMessage message);  }### Answer:
@Test public void testUnknownOperation() throws Exception { PhaseInterceptor<NMRMessage> interceptor = new NMROperationInInterceptor(); NMRMessage msg = new NMRMessage(new MessageImpl()); Exchange me = EasyMock.createMock(Exchange.class); EasyMock.expect(me.getOperation()).andReturn(new QName("urn:test", "SayHi")).times(4); EasyMock.replay(me); msg.put(Exchange.class, me); TestApplicationContext ctx = new TestApplicationContext(new String[] { S1, S2 }); ConfigurerImpl cfg = new ConfigurerImpl(ctx); Bus bus = (Bus) ctx.getBean(Bus.DEFAULT_BUS_ID); bus.setExtension(cfg, Configurer.class); assertNotNull(bus.getExtension(BindingFactoryManager.class).getBindingFactory(NMRConstants.NS_NMR_BINDING)); EndpointInfo endpointInfo = new EndpointInfo(); endpointInfo.setBinding(new NMRBindingInfo(null, NMRConstants.NS_NMR_BINDING)); Endpoint ep = new EndpointImpl(BusFactory.getDefaultBus(), null, endpointInfo); msg.setExchange(new ExchangeImpl()); msg.getExchange().put(Endpoint.class, ep); try { interceptor.handleMessage(msg); fail("shouldn't found SayHi operation"); } catch (Fault fault) { assertEquals(fault.getMessage(), new Message("UNKNOWN_OPERATION", BUNDLE, msg.getNmrExchange().getOperation().toString()).toString()); } }