Fix test case

This commit is contained in:
Reinhard Pointner 2017-05-22 20:43:02 +08:00
parent 3d8360998f
commit ce4756dd10
1 changed files with 4 additions and 5 deletions

View File

@ -10,12 +10,11 @@ public class SupportDialogTest {
@Test
public void feelingLucky() {
assertTrue(SupportDialog.AppStoreReview.feelingLucky(2000, 2000, 500, -1, 0));
assertFalse(SupportDialog.AppStoreReview.feelingLucky(2000, 2000, 400, 400, 1));
assertTrue(SupportDialog.Donation.feelingLucky(2000, 2000, 400, -1, 0));
assertFalse(SupportDialog.Donation.feelingLucky(100, 100, 400, -1, 0));
assertFalse(SupportDialog.Donation.feelingLucky(2000, 2000, 400, 400, 1));
// make sure that it happens sometimes or never
assertTrue(IntStream.range(0, 100).anyMatch(i -> SupportDialog.AppStoreReview.feelingLucky(6001, 5001, 500, -1, 0)));
assertTrue(IntStream.range(0, 100).noneMatch(i -> SupportDialog.AppStoreReview.feelingLucky(2000, 2000, 400, 400, 1)));
assertTrue(IntStream.range(0, 100).anyMatch(i -> SupportDialog.Donation.feelingLucky(0, 5000, 400, -1, 0)));
assertFalse(IntStream.range(0, 100).anyMatch(i -> SupportDialog.Donation.feelingLucky(0, 5000, 400, 400, 2)));