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