### Question:
AmqpJmsMessagePropertyIntercepter { public static void setProperty(AmqpJmsMessageFacade message, String name, Object value) throws JMSException { PropertyIntercepter propertyExpression = PROPERTY_INTERCEPTERS.get(name); if (propertyExpression != null) { propertyExpression.setProperty(message, value); } else { message.setApplicationProperty(name, value); } }  static Object getProperty(AmqpJmsMessageFacade message, String name); static void setProperty(AmqpJmsMessageFacade message, String name, Object value); static boolean propertyExists(AmqpJmsMessageFacade message, String name); static Set<String> getAllPropertyNames(); static Set<String> getPropertyNames(AmqpJmsMessageFacade message); static void clearProperties(AmqpJmsMessageFacade message);  }### Answer:
@Test public void testSetPropertyWithNonInterceptedNameCallsIntoFacade() throws JMSException { AmqpJmsMessageFacade message = createAmqpMessageFacade(); AmqpJmsMessagePropertyIntercepter.setProperty(message, "SomeRandomPropertyName", "Something"); Mockito.doThrow(new JMSException("Expected")).when(message).setApplicationProperty(Mockito.anyString(), Mockito.anyString()); try { AmqpJmsMessagePropertyIntercepter.setProperty(message, "SomeRandomPropertyName", "Something"); fail("Should have thrown"); } catch (JMSException ex) { assertEquals("Expected", ex.getMessage()); } }
@Test public void testSetJmsAmqpTtl() throws JMSException { AmqpJmsMessageFacade message = createAmqpMessageFacade(); AmqpJmsMessagePropertyIntercepter.setProperty(message, JMS_AMQP_TTL, 65536L); Mockito.verify(message).setAmqpTimeToLiveOverride(65536L); }
@Test public void testSetJmsAmqpTtlConversionChecks() throws JMSException { AmqpJmsMessageFacade message = createAmqpMessageFacade(); try { AmqpJmsMessagePropertyIntercepter.setProperty(message, JMS_AMQP_TTL, new byte[1]); fail("Should have thrown an exception for this call"); } catch (JMSException e) { } }
@Test public void testSetJmsAmqpReplyToGroupId() throws JMSException { String testValue = "ReplyToGroupId"; AmqpJmsMessageFacade message = createAmqpMessageFacade(); AmqpJmsMessagePropertyIntercepter.setProperty(message, JMS_AMQP_REPLY_TO_GROUP_ID, testValue); Mockito.verify(message).setReplyToGroupId(testValue); }
@Test public void testSetJmsAmqpReplyToGroupIdConversionChecks() throws JMSException { AmqpJmsMessageFacade message = createAmqpMessageFacade(); try { AmqpJmsMessagePropertyIntercepter.setProperty(message, JMS_AMQP_REPLY_TO_GROUP_ID, new byte[1]); fail("Should have thrown an exception for this call"); } catch (JMSException e) { } }
@Test public void testSetJmsAmqpTypedEncoding() throws JMSException { AmqpJmsObjectMessageFacade message = createAmqpObjectMessageFacade(); AmqpJmsMessagePropertyIntercepter.setProperty(message, JMS_AMQP_TYPED_ENCODING, true); Mockito.verify(message).setUseAmqpTypedEncoding(true); }
@Test public void testSetJmsAmqpTypedEncodingOnNonObjectMessage() throws JMSException { AmqpJmsMessageFacade message = createAmqpMessageFacade(); try { AmqpJmsMessagePropertyIntercepter.setProperty(message, JMS_AMQP_TYPED_ENCODING, true); fail("Should have thrown an exception"); } catch (MessageFormatException mfe) { } }
@Test public void testSetJmsAmqpTypedEncodingConversionChecks() throws JMSException { AmqpJmsObjectMessageFacade message = createAmqpObjectMessageFacade(); try { AmqpJmsMessagePropertyIntercepter.setProperty(message, JMS_AMQP_TYPED_ENCODING, new byte[1]); fail("Should have thrown an exception for this call"); } catch (JMSException e) { } }