@Test public void getProveShouldThrowExcpetionWhenNull() { expectedException.expect(NullPointerException.class); guiceProbeProvider.getProbe(null); }
@SuppressWarnings("unchecked") public <T extends GuiceProbe> T getProbe(Class<T> clazz) { Preconditions.checkNotNull(clazz); return Optional.ofNullable(registry.get(clazz)) .map(probe -> (T) probe) .orElseThrow(() -> new RuntimeException("No probe registered for class: " + clazz)); }
GuiceProbeProvider { @SuppressWarnings("unchecked") public <T extends GuiceProbe> T getProbe(Class<T> clazz) { Preconditions.checkNotNull(clazz); return Optional.ofNullable(registry.get(clazz)) .map(probe -> (T) probe) .orElseThrow(() -> new RuntimeException("No probe registered for class: " + clazz)); } }
GuiceProbeProvider { @SuppressWarnings("unchecked") public <T extends GuiceProbe> T getProbe(Class<T> clazz) { Preconditions.checkNotNull(clazz); return Optional.ofNullable(registry.get(clazz)) .map(probe -> (T) probe) .orElseThrow(() -> new RuntimeException("No probe registered for class: " + clazz)); } @SuppressWarnings("unchecked") @Inject  GuiceProbeProvider(Set<GuiceProbe> guiceProbes); }
GuiceProbeProvider { @SuppressWarnings("unchecked") public <T extends GuiceProbe> T getProbe(Class<T> clazz) { Preconditions.checkNotNull(clazz); return Optional.ofNullable(registry.get(clazz)) .map(probe -> (T) probe) .orElseThrow(() -> new RuntimeException("No probe registered for class: " + clazz)); } @SuppressWarnings("unchecked") @Inject  GuiceProbeProvider(Set<GuiceProbe> guiceProbes); @SuppressWarnings("unchecked") T getProbe(Class<T> clazz); }
GuiceProbeProvider { @SuppressWarnings("unchecked") public <T extends GuiceProbe> T getProbe(Class<T> clazz) { Preconditions.checkNotNull(clazz); return Optional.ofNullable(registry.get(clazz)) .map(probe -> (T) probe) .orElseThrow(() -> new RuntimeException("No probe registered for class: " + clazz)); } @SuppressWarnings("unchecked") @Inject  GuiceProbeProvider(Set<GuiceProbe> guiceProbes); @SuppressWarnings("unchecked") T getProbe(Class<T> clazz);  }