use of org.eclipse.jface.databinding.conformance.util.CurrentRealm in project eclipse.platform.ui by eclipse-platform.
the class AbstractVetoableValueTest method testSetValueInvokesDoSetApprovedValue.
@Test
public void testSetValueInvokesDoSetApprovedValue() throws Exception {
class VetoableValue extends VetoableValueStub {
int count;
Object value;
VetoableValue(Realm realm) {
super(realm);
}
@Override
protected void doSetApprovedValue(Object value) {
count++;
this.value = value;
}
}
Realm realm = new CurrentRealm(true);
VetoableValue vetoableValue = new VetoableValue(realm);
assertEquals(0, vetoableValue.count);
assertEquals(null, vetoableValue.value);
Object value = new Object();
vetoableValue.setValue(value);
assertEquals(1, vetoableValue.count);
assertEquals(value, vetoableValue.value);
}
use of org.eclipse.jface.databinding.conformance.util.CurrentRealm in project eclipse.platform.ui by eclipse-platform.
the class RealmTest method testSetDefaultWithRunnable.
@Test
public void testSetDefaultWithRunnable() throws Exception {
Realm oldRealm = new CurrentRealm(true);
final Realm newRealm = new CurrentRealm(true);
RealmTester.setDefault(oldRealm);
Realm.runWithDefault(newRealm, () -> assertEquals("new realm should be default", newRealm, Realm.getDefault()));
assertEquals("old realm should have been restored", oldRealm, Realm.getDefault());
}
use of org.eclipse.jface.databinding.conformance.util.CurrentRealm in project eclipse.platform.ui by eclipse-platform.
the class AbstractObservableListTest method setUp.
@Before
public void setUp() throws Exception {
RealmTester.setDefault(new CurrentRealm(true));
list = new AbstractObservableListStub<>();
}
use of org.eclipse.jface.databinding.conformance.util.CurrentRealm in project eclipse.platform.ui by eclipse-platform.
the class ObservableListTest method setUp.
@Before
public void setUp() throws Exception {
RealmTester.setDefault(new CurrentRealm(true));
list = new ObservableListStub<>(new ArrayList<>(0), Object.class);
}
Aggregations