@Test public void testNoParameters() { TrackInstantiation.reset(); NoParameters noParameters = reportCollectionFactory.createReportCollection(NoParameters.class); TrackInstantiation.assertInstantiated(); ArgumentCaptor<String> stringCaptor = ArgumentCaptor.forClass(String.class); ArgumentCaptor<TrackInstantiation> reportCaptor = ArgumentCaptor.forClass(TrackInstantiation.class); verify(reportExporter).export(reportCaptor.capture(), eq(false), stringCaptor.capture(), tagCaptor.capture()); assertEquals(stringCaptor.getValue(), "NoParameters.Add"); assertEquals(tagCaptor.getValue(), ImmutableMap.of()); assertNotNull(reportCaptor.getValue()); assertNotNull(noParameters.add()); }
@SuppressWarnings("unchecked") public <T> T createReportCollection(Class<T> aClass) { requireNonNull(aClass, "class is null"); return (T) newProxyInstance(aClass.getClassLoader(), new Class[]{aClass}, new StatInvocationHandler(aClass, false, Optional.of(aClass.getSimpleName()), ImmutableMap.of())); }
ReportCollectionFactory { @SuppressWarnings("unchecked") public <T> T createReportCollection(Class<T> aClass) { requireNonNull(aClass, "class is null"); return (T) newProxyInstance(aClass.getClassLoader(), new Class[]{aClass}, new StatInvocationHandler(aClass, false, Optional.of(aClass.getSimpleName()), ImmutableMap.of())); } }
ReportCollectionFactory { @SuppressWarnings("unchecked") public <T> T createReportCollection(Class<T> aClass) { requireNonNull(aClass, "class is null"); return (T) newProxyInstance(aClass.getClassLoader(), new Class[]{aClass}, new StatInvocationHandler(aClass, false, Optional.of(aClass.getSimpleName()), ImmutableMap.of())); } @Inject  ReportCollectionFactory(ReportExporter reportExporter); protected  ReportCollectionFactory(ReportExporter reportExporter, Ticker ticker); }
ReportCollectionFactory { @SuppressWarnings("unchecked") public <T> T createReportCollection(Class<T> aClass) { requireNonNull(aClass, "class is null"); return (T) newProxyInstance(aClass.getClassLoader(), new Class[]{aClass}, new StatInvocationHandler(aClass, false, Optional.of(aClass.getSimpleName()), ImmutableMap.of())); } @Inject  ReportCollectionFactory(ReportExporter reportExporter); protected  ReportCollectionFactory(ReportExporter reportExporter, Ticker ticker); @SuppressWarnings("unchecked") T createReportCollection(Class<T> aClass); @SuppressWarnings("unchecked") T createReportCollection(Class<T> aClass, boolean applicationPrefix, @Nullable String namePrefix, Map<String, String> tags); @Deprecated @SuppressWarnings("unchecked") T createReportCollection(Class<T> aClass, String name); }
ReportCollectionFactory { @SuppressWarnings("unchecked") public <T> T createReportCollection(Class<T> aClass) { requireNonNull(aClass, "class is null"); return (T) newProxyInstance(aClass.getClassLoader(), new Class[]{aClass}, new StatInvocationHandler(aClass, false, Optional.of(aClass.getSimpleName()), ImmutableMap.of())); } @Inject  ReportCollectionFactory(ReportExporter reportExporter); protected  ReportCollectionFactory(ReportExporter reportExporter, Ticker ticker); @SuppressWarnings("unchecked") T createReportCollection(Class<T> aClass); @SuppressWarnings("unchecked") T createReportCollection(Class<T> aClass, boolean applicationPrefix, @Nullable String namePrefix, Map<String, String> tags); @Deprecated @SuppressWarnings("unchecked") T createReportCollection(Class<T> aClass, String name);  }