use of io.requery.util.ObservableList in project requery by requery.
the class ObservableCollectionTest method observableCollections.
@Parameterized.Parameters
public static <T extends Collection<Phone> & ObservableCollection<Phone>> Collection<T> observableCollections() {
Person person = new Person();
// ObservableList
List<Phone> observableList = person.getPhoneNumbersList();
assertTrue(observableList instanceof ObservableList);
// ObservableSet
Set<Phone> observableSet = person.getPhoneNumbersSet();
assertTrue(observableSet instanceof ObservableSet);
return Arrays.asList((T) observableList, (T) observableSet);
}
use of io.requery.util.ObservableList in project requery by requery.
the class CollectionChangesTest method setUp.
@Before
public void setUp() {
// Create some mock objects (Person has a to-many relationship to Phone)
phone1 = new Phone();
phone2 = new Phone();
person = new Person();
person.getPhoneNumbersList().add(phone1);
person.getPhoneNumbersList().add(phone2);
// Make sure that initial status of Observable collection is clear (no elements added or removed)
assertTrue(person.getPhoneNumbersList() instanceof ObservableList);
observableList = (ObservableList) person.getPhoneNumbersList();
assertTrue(observableList.observer() instanceof CollectionChanges);
collectionChanges = (CollectionChanges) observableList.observer();
collectionChanges.clear();
assertTrue(collectionChanges.addedElements().isEmpty());
assertTrue(collectionChanges.removedElements().isEmpty());
}
Aggregations