App { public static String getVersion() { String version = String.format(Locale.US, "%s (#%d)", BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE); if (BuildConfig.INTERNAL_BUILD) { version = String.format(Locale.US, "%s — commit %s", version, BuildConfig.GIT_SHA); } return version; } private  App(); static boolean isCompatible(int apiLevel); static String getVersion(); static void setExactAlarm(AlarmManager alarmManager, long triggerAtMillis, PendingIntent operation); @Nullable static String getPhotoUrl(@Nullable Session session);  }
@Test public void should_return_formatted_string_version() { assume().withFailureMessage("Do not test internal builds").that(BuildConfig.INTERNAL_BUILD).isFalse(); String expected = BuildConfig.VERSION_NAME + " (#" + BuildConfig.VERSION_CODE + ")"; String version = App.getVersion(); assertThat(version).isEqualTo(expected); }