Search in sources :

Example 36 with Observer

use of java.util.Observer in project j2objc by google.

the class ObservableTest method test_observableWithOverridenHasChanged.

// http://b/28797950
public void test_observableWithOverridenHasChanged() throws Exception {
    final AtomicReference<Observable> updated = new AtomicReference<>();
    final Observer observer = (observable1, data) -> updated.set(observable1);
    Observable alwaysChanging = new AlwaysChangedObservable();
    alwaysChanging.addObserver(observer);
    alwaysChanging.notifyObservers(null);
    assertSame(alwaysChanging, updated.get());
}
Also used : Observer(java.util.Observer) Vector(java.util.Vector) Observable(java.util.Observable) AtomicReference(java.util.concurrent.atomic.AtomicReference) Observer(java.util.Observer) AtomicReference(java.util.concurrent.atomic.AtomicReference) Observable(java.util.Observable)

Aggregations

Observer (java.util.Observer)36 Observable (java.util.Observable)29 Test (org.junit.Test)12 ContentQueryMap (android.content.ContentQueryMap)6 ContentResolver (android.content.ContentResolver)6 ContentValues (android.content.ContentValues)6 Cursor (android.database.Cursor)6 Handler (android.os.Handler)6 MediumTest (android.test.suitebuilder.annotation.MediumTest)6 CountDownLatch (java.util.concurrent.CountDownLatch)5 Map (java.util.Map)2 Properties (java.util.Properties)2 IJobChangeEvent (org.eclipse.core.runtime.jobs.IJobChangeEvent)2 IJobChangeListener (org.eclipse.core.runtime.jobs.IJobChangeListener)2 Job (org.eclipse.core.runtime.jobs.Job)2 ITestActor (org.getopentest.contracts.ITestActor)2 IDataObject (org.jcryptool.core.operations.dataobject.IDataObject)2 KeyStoreAlias (org.jcryptool.crypto.keystore.backend.KeyStoreAlias)2 ParameterizedConstructorInstantiator (org.mockito.internal.util.reflection.FieldInitializer.ParameterizedConstructorInstantiator)2 CvsBundle (com.intellij.CvsBundle)1