AbstractHonoClient { protected static final void setApplicationProperties(final Message msg, final Map<String, ?> properties) { if (properties != null) { final Map<String, Object> propsToAdd = new HashMap<>(); for (final Map.Entry<String, ?> entry: properties.entrySet()) { if (entry.getValue() != null) { if (entry.getValue() instanceof List) { throw new IllegalArgumentException(String.format("Application property %s can't be a List", entry.getKey())); } else if (entry.getValue() instanceof Map) { throw new IllegalArgumentException(String.format("Application property %s can't be a Map", entry.getKey())); } else if (entry.getValue().getClass().isArray()) { throw new IllegalArgumentException(String.format("Application property %s can't be an Array", entry.getKey())); } } propsToAdd.put(entry.getKey(), entry.getValue()); } final ApplicationProperties applicationProperties = new ApplicationProperties(propsToAdd); msg.setApplicationProperties(applicationProperties); } } protected  AbstractHonoClient(final HonoConnection connection); final boolean supportsCapability(final Symbol capability);  }
@Test public void testApplicationPropertiesAreSetAtTheMessage() { final Message msg = mock(Message.class); final Map<String, Object> applicationProps = new HashMap<>(); applicationProps.put("string-key", "value"); applicationProps.put("int-key", 15); applicationProps.put("long-key", 1000L); final ArgumentCaptor<ApplicationProperties> applicationPropsCaptor = ArgumentCaptor.forClass(ApplicationProperties.class); AbstractHonoClient.setApplicationProperties(msg, applicationProps); verify(msg).setApplicationProperties(applicationPropsCaptor.capture()); assertThat(applicationPropsCaptor.getValue().getValue()).isEqualTo(applicationProps); }