@Test public void wrongId() throws Exception { final Instance verifierWebWorkerProviders = mock(Instance.class); final ArrayList<Object> webWorkerProviders = new ArrayList<>(); webWorkerProviders.add(getWebWorkerProvider("somethingElse")); doReturn(webWorkerProviders.iterator()).when(verifierWebWorkerProviders).iterator(); assertFalse(new VerifierWebWorkerRegistry(verifierWebWorkerProviders).get("something").isPresent()); }
public Optional<VerifierWebWorkerProvider> get(final String id) { if (map.containsKey(id)) { return Optional.of(map.get(id)); } else { return Optional.empty(); } }
VerifierWebWorkerRegistry { public Optional<VerifierWebWorkerProvider> get(final String id) { if (map.containsKey(id)) { return Optional.of(map.get(id)); } else { return Optional.empty(); } } }
VerifierWebWorkerRegistry { public Optional<VerifierWebWorkerProvider> get(final String id) { if (map.containsKey(id)) { return Optional.of(map.get(id)); } else { return Optional.empty(); } } VerifierWebWorkerRegistry(); @Inject  VerifierWebWorkerRegistry(@Any final Instance<VerifierWebWorkerProvider> verifierWebWorkerProviders); }
VerifierWebWorkerRegistry { public Optional<VerifierWebWorkerProvider> get(final String id) { if (map.containsKey(id)) { return Optional.of(map.get(id)); } else { return Optional.empty(); } } VerifierWebWorkerRegistry(); @Inject  VerifierWebWorkerRegistry(@Any final Instance<VerifierWebWorkerProvider> verifierWebWorkerProviders); Optional<VerifierWebWorkerProvider> get(final String id); }
VerifierWebWorkerRegistry { public Optional<VerifierWebWorkerProvider> get(final String id) { if (map.containsKey(id)) { return Optional.of(map.get(id)); } else { return Optional.empty(); } } VerifierWebWorkerRegistry(); @Inject  VerifierWebWorkerRegistry(@Any final Instance<VerifierWebWorkerProvider> verifierWebWorkerProviders); Optional<VerifierWebWorkerProvider> get(final String id);  }