diff --git a/app/src/androidTest/java/com/github/javiersantos/piracychecker/UnauthorizedAppTest.java b/app/src/androidTest/java/com/github/javiersantos/piracychecker/UnauthorizedAppTest.java index 3df373b..1bb2a49 100644 --- a/app/src/androidTest/java/com/github/javiersantos/piracychecker/UnauthorizedAppTest.java +++ b/app/src/androidTest/java/com/github/javiersantos/piracychecker/UnauthorizedAppTest.java @@ -29,6 +29,34 @@ public class UnauthorizedAppTest { @Rule public final ActivityTestRule uiThreadTestRule = new ActivityTestRule<>(MainActivity.class); + @Test + public void verifyUnauthorizedCustomApp_ALLOW() throws Throwable { + final CountDownLatch signal = new CountDownLatch(1); + uiThreadTestRule.runOnUiThread(new Runnable() { + @Override + public void run() { + new PiracyChecker(InstrumentationRegistry.getTargetContext()) + .addAppToCheck(new PirateApp("Demo", uiThreadTestRule.getActivity().getPackageName() + ".other")) + .callback(new PiracyCheckerCallback() { + @Override + public void allow() { + assertTrue("PiracyChecker OK", true); + signal.countDown(); + } + + @Override + public void dontAllow(@NonNull PiracyCheckerError error, @Nullable PirateApp app) { + assertTrue("PiracyChecker FAILED : PiracyCheckError is not " + error.toString(), false); + signal.countDown(); + } + }) + .start(); + } + }); + + signal.await(30, TimeUnit.SECONDS); + } + @Test public void verifyUnauthorizedCustomApp_DONTALLOW() throws Throwable { final CountDownLatch signal = new CountDownLatch(1);