Skip to content

Commit

Permalink
Add another test
Browse files Browse the repository at this point in the history
  • Loading branch information
javiersantos committed Feb 25, 2018
1 parent 2ebe2fb commit 6a271ea
Showing 1 changed file with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,34 @@ public class UnauthorizedAppTest {
@Rule
public final ActivityTestRule<MainActivity> 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);
Expand Down

0 comments on commit 6a271ea

Please sign in to comment.