Example usage for android.test MoreAsserts assertNotContainsRegex

List of usage examples for android.test MoreAsserts assertNotContainsRegex

Introduction

In this page you can find the example usage for android.test MoreAsserts assertNotContainsRegex.

Prototype

public static void assertNotContainsRegex(String expectedRegex, String actual) 

Source Link

Document

Variant of #assertNotContainsRegex(String,String,String) using a generic message.

Usage

From source file:com.ichi2.libanki.test.SchedTestCase.java

@MediumTest
public void test_finished() {
    Collection d = Shared.getEmptyDeck(getInstrumentation().getContext());
    assertNotNull(d);/*from w ww.  j a va 2s . 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);
}