RxPalette { @CheckResult @NonNull public static Single<Palette> generate(@NonNull final Bitmap bitmap) { return Single.fromCallable(new Callable<Palette>() { @Override public Palette call() throws Exception { return Palette.from(bitmap).generate(); } }); }  @CheckResult @NonNull static Single<Palette> generate(@NonNull final Bitmap bitmap); @CheckResult @NonNull static Single<Palette> generate(@NonNull final Palette.Builder builder);  }
@Test public void testGenerate() { RxPalette.generate(bitmap) .test() .assertNoErrors() .assertComplete() .assertValueCount(1); }
@Test public void testBuilderGenerate() { RxPalette.generate(Palette.from(bitmap)) .test() .assertNoErrors() .assertComplete() .assertValueCount(1); }
@Test public void testNullGenerate() { Bitmap nullBitmap = null; RxPalette.generate(nullBitmap) .test() .assertError(IllegalArgumentException.class); }
@Test public void testNullBuilderGenerate() { TestSubscriber<Palette> testSubscriber = new TestSubscriber<>(); Palette.Builder nullBuilder = null; RxPalette.generate(nullBuilder) .test() .assertError(NullPointerException.class); }