private MapMessage newMapMessage(Map<String, Object> body) throws JMSException {
   MapMessage message = new MapMessageImpl();
   for (String key : body.keySet()) {
     Object value = body.get(key);
     message.setObject(key, value);
   }
   return message;
 }
  @Test
  public void shouldMapSendOperationAttribute() throws JMSException {
    MappedApi service = service(new MappingBuilder("myop").build());

    // When
    service.mappedNoArgCall();

    // Then
    MapMessage message = (MapMessage) captureMessage();
    assertEquals("mappedNoArgCall", message.getObject("myop"));
  }
  @Test
  public void shouldMapSendAttributes() throws JMSException {
    // Given
    MappedApi proxy = MessageSender.of(MappedApi.class);

    // When
    proxy.mappedCall("a", 0L);

    // Then
    MapMessage message = (MapMessage) captureMessage();
    assertEquals("a", message.getObject("A"));
    assertEquals("0", message.getObject("B"));
  }
  @Test
  public void shouldMapSendOperationName() throws JMSException {
    // Given
    Mapping mapping =
        new MappingBuilder(OPERATION_FIELD_NAME) //
            .mapOperation("mappedNoArgCall", "MAPPED_NOARG_OP")
            .build();
    MappedApi service = service(mapping);

    // When
    service.mappedNoArgCall();

    // Then
    MapMessage message = (MapMessage) captureMessage();
    assertEquals("MAPPED_NOARG_OP", message.getObject(OPERATION_FIELD_NAME));
  }
  @Test
  public void shouldSendAttributesUsingExplicitConversion(boolean flag) throws JMSException {
    // Given
    LocalDate today = new LocalDate();
    String pattern = "dd.MM.YYYY";
    Mapping mapping =
        new MappingBuilder(OPERATION_FIELD_NAME) //
            .mapField("date", FieldMapping.map("date", new JodaLocalDateConverter(pattern))) //
            .mapField("flag", FieldMapping.map("flag", new StringToBooleanConverter("1", "0"))) //
            .build();
    MapJmsPayloadHandler payloadHandler = new MapJmsPayloadHandler(mapping);
    JodaTimeApi service = JmsSenderFactory.create(CONFIG, payloadHandler).create(JodaTimeApi.class);

    // When
    service.localDateCall(today, flag);

    // Then
    MapMessage message = (MapMessage) captureMessage();
    assertEquals(today.toString(pattern), message.getString("date"));
    assertEquals(flag ? "1" : "0", message.getString("flag"));
  }