1 package org.robolectric.shadows; 2 3 import static org.assertj.core.api.Assertions.assertThat; 4 5 import android.widget.CheckBox; 6 import org.junit.Test; 7 import org.junit.runner.RunWith; 8 import org.robolectric.RobolectricTestRunner; 9 import org.robolectric.RuntimeEnvironment; 10 11 @RunWith(RobolectricTestRunner.class) 12 public class ShadowCheckBoxTest { 13 @Test 14 public void testWorks() throws Exception { 15 CheckBox checkBox = new CheckBox(RuntimeEnvironment.application); 16 assertThat(checkBox.isChecked()).isFalse(); 17 18 checkBox.setChecked(true); 19 assertThat(checkBox.isChecked()).isTrue(); 20 21 checkBox.toggle(); 22 assertThat(checkBox.isChecked()).isFalse(); 23 24 checkBox.performClick(); // Used to support performClick(), but Android doesn't. Sigh. 25 // assertThat(checkBox.isChecked()).isFalse(); 26 } 27 } 28