forked from mttkay/calculon
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add view resolvers and assertions for compound buttons such as radio …
…buttons or check boxes
- Loading branch information
Showing
2 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/main/java/com/github/calculon/assertion/CompoundButtonAssertion.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.github.calculon.assertion; | ||
|
||
import static junit.framework.Assert.assertFalse; | ||
import static junit.framework.Assert.assertTrue; | ||
import android.app.Activity; | ||
import android.test.InstrumentationTestCase; | ||
import android.widget.CompoundButton; | ||
|
||
public class CompoundButtonAssertion extends ViewAssertion { | ||
|
||
private CompoundButton compoundButton; | ||
|
||
public CompoundButtonAssertion(InstrumentationTestCase testCase, Activity activity, | ||
CompoundButton compoundButton) { | ||
super(testCase, activity, compoundButton); | ||
this.compoundButton = compoundButton; | ||
} | ||
|
||
public void checked() { | ||
assertTrue("expected view to be checked, but it wasn't", compoundButton.isChecked()); | ||
} | ||
|
||
public void unchecked() { | ||
assertFalse("expected view to not be checked, but it was", compoundButton.isChecked()); | ||
} | ||
} |