### Question:
DefaultServiceRegistry implements ServiceRegistry { @NotNull @Override @SuppressWarnings("unchecked") public <T> Optional<T> getProvider(@NotNull Class<T> service) { ServiceRegistryEntry<T> entry = (ServiceRegistryEntry<T>) this.entries.get(service); return entry == null ? Optional.empty() : Optional.of(entry.getProvider()); }  @Override void setProvider(@NotNull Class<T> service, @NotNull T provider, boolean immutable, boolean needsReplacement); @NotNull @Override @SuppressWarnings("unchecked") Optional<T> getProvider(@NotNull Class<T> service); @NotNull @Override @SuppressWarnings("unchecked") Optional<ServiceRegistryEntry<T>> getRegisteredEntry(@NotNull Class<T> service); @NotNull @Override @SuppressWarnings("unchecked") T getProviderUnchecked(@NotNull Class<T> service); @NotNull @Override @UnmodifiableView Collection<ServiceRegistryEntry<?>> getRegisteredServices(); @Override @SuppressWarnings("unchecked") void unregisterService(@NotNull Class<T> service, @Nullable T replacement);  }### Answer:
@Test @Order(2) void testGetProvider() { Assertions.assertTrue(this.serviceRegistry.getProvider(AService.class).isPresent()); Assertions.assertFalse(this.serviceRegistry.getProvider(DefaultServiceRegistryTest.class).isPresent()); }