List of usage examples for android.test MoreAsserts assertContainsRegex
public static MatchResult assertContainsRegex(String expectedRegex, String actual)
From source file:com.ichi2.libanki.test.SchedTestCase.java
@MediumTest public void test_finished() { Collection d = Shared.getEmptyDeck(getInstrumentation().getContext()); assertNotNull(d);//from w w w . j a v a 2 s .c o m // nothing due String finishedMsg = d.getSched().finishedMsg(getInstrumentation().getTargetContext()).toString(); MoreAsserts.assertContainsRegex(Pattern.quote("Congratulations"), finishedMsg); MoreAsserts.assertNotContainsRegex(Pattern.quote("limit"), finishedMsg); Note f = d.newNote(); f.setitem("Front", "one"); f.setitem("Back", "two"); d.addNote(f); // have a new card finishedMsg = d.getSched().finishedMsg(getInstrumentation().getTargetContext()).toString(); MoreAsserts.assertContainsRegex(Pattern.quote("new cards available"), finishedMsg); // turn it into a review d.reset(); Card c = f.cards().get(0); c.startTimer(); d.getSched().answerCard(c, 3); // nothing should be due tomorrow, as it's due in a week finishedMsg = d.getSched().finishedMsg(getInstrumentation().getTargetContext()).toString(); MoreAsserts.assertContainsRegex(Pattern.quote("Congratulations"), finishedMsg); MoreAsserts.assertNotContainsRegex(Pattern.quote("limit"), finishedMsg); }