protected void mockMessage() throws JMSException {
   String xml =
       "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" //
           + "<testMethodHeaderOnly>\n" //
           + "    <arg0>foo</arg0>\n" //
           + "</testMethodHeaderOnly>\n";
   when(message.getText()).thenReturn(xml);
   when(message.getPropertyNames()).thenReturn(new StringTokenizer("arg1"));
 }
  @Test
  public void shouldSetHeaderOnlyArrayPropertyAnnotation() throws Exception {
    String xml =
        "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n"
            + "<testMethodHeaderOnly>\n" //
            + "    <arg0>foo</arg0>\n" //
            + "</testMethodHeaderOnly>\n";
    when(message.getText()).thenReturn(xml);
    when(message.getPropertyNames()).thenReturn(new StringTokenizer("arg1[0] arg1[1] arg1[2]"));
    when(message.getStringProperty("arg1[0]")).thenReturn("one");
    when(message.getStringProperty("arg1[1]")).thenReturn("two");
    when(message.getStringProperty("arg1[2]")).thenReturn("three");

    XmlMessageDecoder<TestInterfaceHeaderOnlyArray> decoder =
        XmlMessageDecoder.of(TestInterfaceHeaderOnlyArray.class, implArray);

    decoder.onMessage(message);

    verify(implArray).testMethodHeaderOnly("foo", new String[] {"one", "two", "three"});
  }
  @Test
  public void shouldSetHeaderOnlyBytePropertyAnnotation() throws Exception {
    mockMessage();
    when(message.getByteProperty("arg1")).thenReturn((byte) 123);

    XmlMessageDecoder<TestInterfaceHeaderOnlyByte> decoder =
        XmlMessageDecoder.of(TestInterfaceHeaderOnlyByte.class, implByte);

    decoder.onMessage(message);

    verify(implByte).testMethodHeaderOnly("foo", (byte) 123);
  }
  @Test
  public void shouldSetHeaderOnlyPrimitiveBooleanPropertyAnnotation() throws Exception {
    mockMessage();
    when(message.getBooleanProperty("arg1")).thenReturn(true);

    XmlMessageDecoder<TestInterfaceHeaderOnlyPrimitiveBoolean> decoder =
        XmlMessageDecoder.of(TestInterfaceHeaderOnlyPrimitiveBoolean.class, implPrimitiveBoolean);

    decoder.onMessage(message);

    verify(implPrimitiveBoolean).testMethodHeaderOnly("foo", true);
  }
  @Test
  public void shouldSetHeaderOnlyStringPropertyAnnotation() throws Exception {
    mockMessage();
    when(message.getStringProperty("arg1")).thenReturn("123");

    XmlMessageDecoder<TestInterfaceHeaderOnlyString> decoder =
        XmlMessageDecoder.of(TestInterfaceHeaderOnlyString.class, implString);

    decoder.onMessage(message);

    verify(implString).testMethodHeaderOnly("foo", "123");
  }
  @Test
  public void shouldSetHeaderOnlyFloatPropertyAnnotation() throws Exception {
    mockMessage();
    when(message.getFloatProperty("arg1")).thenReturn(12.3f);

    XmlMessageDecoder<TestInterfaceHeaderOnlyFloat> decoder =
        XmlMessageDecoder.of(TestInterfaceHeaderOnlyFloat.class, implFloat);

    decoder.onMessage(message);

    verify(implFloat).testMethodHeaderOnly("foo", 12.3f);
  }
  @Test
  public void shouldSetHeaderOnlyPrimitiveShortPropertyAnnotation() throws Exception {
    mockMessage();
    when(message.getShortProperty("arg1")).thenReturn((short) 123);

    XmlMessageDecoder<TestInterfaceHeaderOnlyPrimitiveShort> decoder =
        XmlMessageDecoder.of(TestInterfaceHeaderOnlyPrimitiveShort.class, implPrimitiveShort);

    decoder.onMessage(message);

    verify(implPrimitiveShort).testMethodHeaderOnly("foo", (short) 123);
  }
  @Test
  public void shouldSetHeaderOnlyMapPropertyAnnotation() throws Exception {
    String xml =
        "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n"
            + "<testMethodHeaderOnly>\n" //
            + "    <arg0>foo</arg0>\n" //
            + "</testMethodHeaderOnly>\n";
    when(message.getText()).thenReturn(xml);
    when(message.getPropertyNames()).thenReturn(new StringTokenizer("arg1[A] arg1[B] arg1[C]"));
    when(message.getStringProperty("arg1[A]")).thenReturn("one");
    when(message.getStringProperty("arg1[B]")).thenReturn("two");
    when(message.getStringProperty("arg1[C]")).thenReturn("three");

    XmlMessageDecoder<TestInterfaceHeaderOnlyMap> decoder =
        XmlMessageDecoder.of(TestInterfaceHeaderOnlyMap.class, implMap);

    decoder.onMessage(message);

    Map<String, String> map = new HashMap<String, String>();
    map.put("A", "one");
    map.put("B", "two");
    map.put("C", "three");
    verify(implMap).testMethodHeaderOnly("foo", map);
  }