blob: d7eee2a88b0bf5f260625b2fcdbb71943b9fc78e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
package com.xtremelabs.robolectric.shadows;
import android.app.Activity;
import android.widget.CheckedTextView;
import com.xtremelabs.robolectric.WithTestDefaultsRunner;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@RunWith(WithTestDefaultsRunner.class)
public class CheckedTextViewTest {
private CheckedTextView checkedTextView;
@Before
public void beforeTests() {
checkedTextView = new CheckedTextView(new Activity());
}
@Test
public void testToggle() {
assertFalse(checkedTextView.isChecked());
checkedTextView.toggle();
assertTrue(checkedTextView.isChecked());
}
@Test
public void testSetChecked() {
assertFalse(checkedTextView.isChecked());
checkedTextView.setChecked(true);
assertTrue(checkedTextView.isChecked());
}
}
|