Preconditions { public static boolean isAtLeastAndroidMarshmallow() { return Build.VERSION.SDK_INT >= Build.VERSION_CODES.M; }  static void checkNotNull(Object object, String message); static void checkNotNullOrEmpty(String string, String message); static void checkGreaterOrEqualToZero(int number, String message); static void checkGreaterThanZero(int number, String message); static boolean isAtLeastAndroidLollipop(); static boolean isAtLeastAndroidMarshmallow();  }
@Test @Config(sdk = 22) public void shouldNotBeAtLeastAndroidMarshmallowForLowerApi() { boolean isAtLeastAndroidMarshmallow = Preconditions.isAtLeastAndroidMarshmallow(); assertThat(isAtLeastAndroidMarshmallow).isFalse(); }
@Test @Config(sdk = 23) public void shouldBeAtLeastAndroidMarshmallow() { boolean isAtLeastAndroidMarshmallow = Preconditions.isAtLeastAndroidMarshmallow(); assertThat(isAtLeastAndroidMarshmallow).isTrue(); }