### Question:
RMContextUtils { public static RMProperties retrieveRMProperties(Message message, boolean outbound) { if (outbound) { return (RMProperties)message.get(getRMPropertiesKey(true)); } Message m = null; if (MessageUtils.isOutbound(message)) { m = message.getExchange().getInMessage(); if (null == m) { m = message.getExchange().getInFaultMessage(); } } else { m = message; } if (null != m) { return (RMProperties)m.get(getRMPropertiesKey(false)); } return null; } protected  RMContextUtils(); static String generateUUID(); static boolean isServerSide(Message message); static boolean isRMProtocolMessage(String action); static RMProperties retrieveRMProperties(Message message, boolean outbound); static void storeRMProperties(Message message, RMProperties rmps, boolean outbound); static AddressingProperties retrieveMAPs(Message message,
                                                    boolean isProviderContext,
                                                    boolean isOutbound); static void storeMAPs(AddressingProperties maps, Message message, boolean isOutbound,
                                 boolean isRequestor); static String getRMPropertiesKey(boolean outbound); static ProtocolVariation getProtocolVariation(Message message); static void setProtocolVariation(Message message, ProtocolVariation protocol);  }### Answer:
@Test public void testRetrieveOutboundRMProperties() { Message msg = control.createMock(Message.class); RMProperties rmps = control.createMock(RMProperties.class); EasyMock.expect(msg.get(RMMessageConstants.RM_PROPERTIES_OUTBOUND)).andReturn(rmps); control.replay(); assertSame(rmps, RMContextUtils.retrieveRMProperties(msg, true)); }
@Test public void testRetrieveInboundRMPropertiesFromOutboundMessage() { Message outMsg = control.createMock(Message.class); Exchange ex = control.createMock(Exchange.class); EasyMock.expect(outMsg.getExchange()).andReturn(ex).times(3); EasyMock.expect(ex.getOutMessage()).andReturn(outMsg); Message inMsg = control.createMock(Message.class); EasyMock.expect(ex.getInMessage()).andReturn(null); EasyMock.expect(ex.getInFaultMessage()).andReturn(inMsg); RMProperties rmps = control.createMock(RMProperties.class); EasyMock.expect(inMsg.get(RMMessageConstants.RM_PROPERTIES_INBOUND)).andReturn(rmps); control.replay(); assertSame(rmps, RMContextUtils.retrieveRMProperties(outMsg, false)); }
@Test public void testRetrieveInboundRMPropertiesFromInboundMessage() { Message inMsg = control.createMock(Message.class); Exchange ex = control.createMock(Exchange.class); EasyMock.expect(inMsg.getExchange()).andReturn(ex); EasyMock.expect(ex.getOutMessage()).andReturn(null); EasyMock.expect(ex.getOutFaultMessage()).andReturn(null); RMProperties rmps = control.createMock(RMProperties.class); EasyMock.expect(inMsg.get(RMMessageConstants.RM_PROPERTIES_INBOUND)).andReturn(rmps); control.replay(); assertSame(rmps, RMContextUtils.retrieveRMProperties(inMsg, false)); }