DiagnosticServiceDescriptor implements DiagnosticServicesRegistration<T> { boolean matches(Class<?> serviceInterface) { return matches(serviceInterface.getName()); } DiagnosticServiceDescriptor(Class<T> serviceInterface, T serviceImplementation, Runnable onClose, Function<String, Boolean> jmxExpose); @Override Class<T> getServiceInterface(); @Override boolean exposeMBean(String name); @Override void close(); Set<String> getRegisteredMBeans();  }
@Test public void test_matches() { DiagnosticServiceDescriptor<Serializable> descriptor = new DiagnosticServiceDescriptor<>(Serializable.class, objectMapper, noop, mbean); assertThat(() -> descriptor.matches(null), is(throwing(instanceOf(NullPointerException.class)))); assertThat(descriptor.matches(Serializable.class), is(true)); assertThat(descriptor.matches(Closeable.class), is(false)); }