public <V> BooleanPropertyToListBinder<V> to(final List<V> values) { return new BooleanPropertyToListBinder<V>(b, bp, values); }
@Test public void booleanToListInitiallyRemovesWhenTrue() { BooleanProperty b = booleanProperty("b", false); List<String> names = new ArrayList<String>(); names.add("foo"); binder.bind(b).to(names).has("foo"); assertThat(names.size(), is(0)); }
@Test public void booleanToListRemovesOnChange() { BooleanProperty b = booleanProperty("b", true); List<String> names = new ArrayList<String>(); names.add("foo"); binder.bind(b).to(names).has("foo"); assertThat(names.size(), is(1)); b.set(false); assertThat(names.size(), is(0)); }
@Test public void booleanToListInitializePropertyToTrue() { BooleanProperty b = booleanProperty("b"); List<String> names = new ArrayList<String>(); names.add("foo"); binder.bind(b).to(names).has("foo"); assertThat(b.get(), is(true)); assertThat(b.isTouched(), is(false)); }
@Test public void booleanToListAddsOnChange() { BooleanProperty b = booleanProperty("b", false); List<String> names = new ArrayList<String>(); binder.bind(b).to(names).has("foo"); assertThat(names.size(), is(0)); b.set(true); assertThat(names, hasItem("foo")); }
@Test public void booleanToListInitializePropertyToFalse() { BooleanProperty b = booleanProperty("b"); List<String> names = new ArrayList<String>(); binder.bind(b).to(names).has("foo"); assertThat(b.get(), is(false)); assertThat(b.isTouched(), is(false)); }
@Test public void booleanToListAddsInitiallyWhenTrue() { BooleanProperty b = booleanProperty("b", true); List<String> names = new ArrayList<String>(); binder.bind(b).to(names).has("foo"); assertThat(names, hasItem("foo")); }