}
@Test
public void testUnknownOperation() throws Exception {
PhaseInterceptor<JBIMessage> interceptor = new JBIOperationInInterceptor();
JBIMessage msg = new JBIMessage(new MessageImpl());
MessageExchange me = EasyMock.createMock(MessageExchange.class);
EasyMock.expect(me.getOperation()).andReturn(new QName("urn:test", "SayHi")).times(4);
EasyMock.replay(me);
msg.put(MessageExchange.class, me);
EndpointInfo endpointInfo = new EndpointInfo();
endpointInfo.setBinding(new JBIBindingInfo(null, JBIConstants.NS_JBI_BINDING));
Bus bus = BusFactory.getThreadDefaultBus();
bus.setExtension(this.getClass().getClassLoader(), ClassLoader.class);
Endpoint ep = new EndpointImpl(bus, 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.getJbiExchange().getOperation().toString()).toString());
}
}