WelcomeUtils { public static String getKey(Class<? extends WelcomeActivity> activityClass) { String key = null; try { key = (String) activityClass.getMethod("welcomeKey").invoke(null); if (key.isEmpty()) { Log.w(TAG, "welcomeKey() from " + activityClass.getSimpleName() + " returned an empty string. Is that an accident?"); } } catch (NoSuchMethodException e) { } catch (Exception e) { e.printStackTrace(); } if (key == null) { key = ""; } return key; }  static String getKey(Class<? extends WelcomeActivity> activityClass); static void applyParallaxEffect(View view, boolean recursive, int offsetPixels, float startParallaxFactor, float parallaxInterval);  }
@Test public void testGetKey() { assertEquals(WELCOME_KEY, WelcomeUtils.getKey(KeyTestActivity.class)); assertEquals("", WelcomeUtils.getKey(EmptyKeyTestActivity.class)); assertEquals("", WelcomeUtils.getKey(NoKeyTestActivity.class)); }