### Question:
ResponseTimeMessageInInterceptor extends AbstractMessageResponseTimeInterceptor { public void handleMessage(Message message) throws Fault { Exchange ex = message.getExchange(); boolean forceDisabled = Boolean.FALSE.equals(ex.get("org.apache.cxf.management.counter.enabled")); if (!forceDisabled && isServiceCounterEnabled(ex)) { if (isClient(message)) { if (!ex.isOneWay()) { endHandlingMessage(ex); } } else { beginHandlingMessage(ex); } } } ResponseTimeMessageInInterceptor(); void handleMessage(Message message); @Override void handleFault(Message message);  }### Answer:
@Test public void testClientMessageIn() { setupCounterRepository(true, true); setupOperationForMessage(); setupExchangeForMessage(); EasyMock.expect(message.getExchange()).andReturn(exchange); EasyMock.expect(message.get(Message.REQUESTOR_ROLE)).andReturn(Boolean.TRUE).anyTimes(); EasyMock.expect(exchange.getOutMessage()).andReturn(message).anyTimes(); EasyMock.expect(exchange.get("org.apache.cxf.management.counter.enabled")).andReturn(null); EasyMock.expect(exchange.get(FaultMode.class)).andReturn(null); EasyMock.expect(exchange.isOneWay()).andReturn(false); MessageHandlingTimeRecorder mhtr = EasyMock.createMock(MessageHandlingTimeRecorder.class); mhtr.endHandling(); EasyMock.expectLastCall(); mhtr.setFaultMode(null); EasyMock.expectLastCall(); EasyMock.replay(mhtr); EasyMock.expect(exchange.get(MessageHandlingTimeRecorder.class)).andReturn(mhtr); EasyMock.replay(exchange); EasyMock.replay(message); rtmii.handleMessage(message); EasyMock.verify(message); EasyMock.verify(bus); EasyMock.verify(exchange); EasyMock.verify(mhtr); EasyMock.verify(cRepository); }
@Test public void testServerOneWayMessageIn() { setupCounterRepository(true, false); setupExchangeForMessage(); EasyMock.expect(message.getExchange()).andReturn(exchange); EasyMock.expect(message.get(Message.REQUESTOR_ROLE)).andReturn(Boolean.FALSE).anyTimes(); EasyMock.expect(exchange.get("org.apache.cxf.management.counter.enabled")).andReturn(null); EasyMock.expect(exchange.getOutMessage()).andReturn(message); MessageHandlingTimeRecorder mhtr = EasyMock.createMock(MessageHandlingTimeRecorder.class); mhtr.beginHandling(); EasyMock.expectLastCall(); EasyMock.replay(mhtr); EasyMock.expect(exchange.get(MessageHandlingTimeRecorder.class)).andReturn(mhtr); EasyMock.replay(exchange); EasyMock.replay(message); rtmii.handleMessage(message); EasyMock.verify(message); EasyMock.verify(exchange); EasyMock.verify(mhtr); }
@Test public void testServiceMessageIn() { setupCounterRepository(true, false); setupExchangeForMessage(); EasyMock.expect(message.get(Message.REQUESTOR_ROLE)).andReturn(Boolean.FALSE).anyTimes(); EasyMock.expect(message.getExchange()).andReturn(exchange); EasyMock.expect(exchange.get("org.apache.cxf.management.counter.enabled")).andReturn(null); EasyMock.expect(exchange.getOutMessage()).andReturn(message); EasyMock.expect(exchange.get(MessageHandlingTimeRecorder.class)).andReturn(null); exchange.put(EasyMock.eq(MessageHandlingTimeRecorder.class), EasyMock.isA(MessageHandlingTimeRecorder.class)); EasyMock.replay(exchange); EasyMock.replay(message); rtmii.handleMessage(message); EasyMock.verify(message); EasyMock.verify(exchange); }