@Test
public void testAgentConfigInvalidNamePattern() throws Exception {

  temporarySystemProperties.set(Configuration.Property.HEAP_DUMP_NAME.getQualifiedName())
      .to("%hostname%");
  Agent.initAgent(null, logger);
  verify(logger).error(argThat(is("JavaMemoryAssistant cannot start")),
      argThat(allOf(isA(IllegalArgumentException.class),
          hasMessageThat(is("The value '%hostname%' is invalid for the 'jma.heap_dump_name' "
              + "property: the token '%hostname%' (position 0 to 9) is unknown")))));
  verifyNoMoreInteractions(logger);
}