@Test public void setScreen() { Analytics analytics = new Analytics(); Mockito.doAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocation) { ((Runnable) invocation.getArgument(0)).run(); return null; } }).when(((AndroidApplication) Gdx.app)).runOnUiThread(Mockito.any(Runnable.class)); analytics.setScreen("test", AnalyticsTest.class); PowerMockito.verifyStatic(FirebaseAnalytics.class, VerificationModeFactory.times(1)); FirebaseAnalytics.getInstance((Context) Gdx.app); Mockito.verify(firebaseAnalytics, VerificationModeFactory.times(1)) .setCurrentScreen(Mockito.eq((Activity) Gdx.app), Mockito.eq("test"), Mockito.eq(AnalyticsTest.class.getSimpleName())); Mockito.verifyNoMoreInteractions(firebaseAnalytics); }
@Override public void setScreen(final String name, final Class<?> screenClass) { ((AndroidApplication) Gdx.app).runOnUiThread(new Runnable() { @Override public void run() { FirebaseAnalytics.getInstance((AndroidApplication) Gdx.app).setCurrentScreen((AndroidApplication) Gdx.app, name, screenClass.getSimpleName()); } }); }
Analytics implements AnalyticsDistribution { @Override public void setScreen(final String name, final Class<?> screenClass) { ((AndroidApplication) Gdx.app).runOnUiThread(new Runnable() { @Override public void run() { FirebaseAnalytics.getInstance((AndroidApplication) Gdx.app).setCurrentScreen((AndroidApplication) Gdx.app, name, screenClass.getSimpleName()); } }); } }
Analytics implements AnalyticsDistribution { @Override public void setScreen(final String name, final Class<?> screenClass) { ((AndroidApplication) Gdx.app).runOnUiThread(new Runnable() { @Override public void run() { FirebaseAnalytics.getInstance((AndroidApplication) Gdx.app).setCurrentScreen((AndroidApplication) Gdx.app, name, screenClass.getSimpleName()); } }); }  }
Analytics implements AnalyticsDistribution { @Override public void setScreen(final String name, final Class<?> screenClass) { ((AndroidApplication) Gdx.app).runOnUiThread(new Runnable() { @Override public void run() { FirebaseAnalytics.getInstance((AndroidApplication) Gdx.app).setCurrentScreen((AndroidApplication) Gdx.app, name, screenClass.getSimpleName()); } }); }  @Override void logEvent(String name, Map<String, String> params); @Override void setScreen(final String name, final Class<?> screenClass); @Override void setUserProperty(String name, String value); @Override void setUserId(String id); }
Analytics implements AnalyticsDistribution { @Override public void setScreen(final String name, final Class<?> screenClass) { ((AndroidApplication) Gdx.app).runOnUiThread(new Runnable() { @Override public void run() { FirebaseAnalytics.getInstance((AndroidApplication) Gdx.app).setCurrentScreen((AndroidApplication) Gdx.app, name, screenClass.getSimpleName()); } }); }  @Override void logEvent(String name, Map<String, String> params); @Override void setScreen(final String name, final Class<?> screenClass); @Override void setUserProperty(String name, String value); @Override void setUserId(String id);  }