use of org.eclipse.jface.databinding.conformance.util.CurrentRealm in project eclipse.platform.ui by eclipse-platform.
the class WritableListTest method testRemoveByIndexRealmChecks.
@Test
public void testRemoveByIndexRealmChecks() throws Exception {
RealmTester.setDefault(new CurrentRealm(true));
final WritableList<String> list = new WritableList<>();
list.add("");
list.add("");
RealmTester.exerciseCurrent(() -> list.remove(list.size() - 1));
RealmTester.setDefault(null);
}
use of org.eclipse.jface.databinding.conformance.util.CurrentRealm in project eclipse.platform.ui by eclipse-platform.
the class AbstractObservableMapTest method setUp.
@Before
public void setUp() throws Exception {
RealmTester.setDefault(new CurrentRealm(true));
map = new AbstractObservableMapStub<>();
}
use of org.eclipse.jface.databinding.conformance.util.CurrentRealm in project eclipse.platform.ui by eclipse-platform.
the class WritableMapTest method testRemoveRealmChecks.
@Test
public void testRemoveRealmChecks() throws Exception {
RealmTester.exerciseCurrent(() -> {
WritableMap<String, String> map = new WritableMap<>();
CurrentRealm realm = (CurrentRealm) Realm.getDefault();
boolean current = realm.isCurrent();
realm.setCurrent(true);
map.put("", "");
realm.setCurrent(current);
map.remove("");
});
}
use of org.eclipse.jface.databinding.conformance.util.CurrentRealm in project eclipse.platform.ui by eclipse-platform.
the class AbstractObservableTest method testFireChangeRealmChecks.
@Test
public void testFireChangeRealmChecks() throws Exception {
RealmTester.setDefault(new CurrentRealm(true));
RealmTester.exerciseCurrent(() -> {
observable = new ObservableStub();
observable.fireChange();
});
}
use of org.eclipse.jface.databinding.conformance.util.CurrentRealm in project eclipse.platform.ui by eclipse-platform.
the class AbstractObservableValueTest method testSetValueInvokesDoSetValue.
@Test
public void testSetValueInvokesDoSetValue() throws Exception {
class ValueStub extends ObservableValueStub {
int doSetValue;
ValueStub(Realm realm) {
super(realm);
}
@Override
protected void doSetValue(Object value) {
doSetValue++;
}
}
Realm realm = new CurrentRealm(true);
ValueStub stub = new ValueStub(realm);
assertEquals(0, stub.doSetValue);
stub.setValue(new Object());
assertEquals("doSetValue should have been invoked", 1, stub.doSetValue);
}
Aggregations