use of sqlite.feature.many2many.case7.Person in project modello by codehaus-plexus.
the class OneToManyAssociationVerifier method testMap.
private void testMap() {
ListSetMapProperties foo = new ListSetMapProperties();
Integer i1 = new Integer(1);
Integer i2 = new Integer(2);
Person person1 = new Person();
Person person2 = new Person();
foo.addMap(i1, person1);
Assert.assertEquals("map.size", 1, foo.getMap().size());
foo.addMap(i1, person1);
Assert.assertEquals("map.size", 1, foo.getMap().size());
foo.addMap(i2, person2);
Assert.assertEquals("map.size", 2, foo.getMap().size());
}
use of sqlite.feature.many2many.case7.Person in project modello by codehaus-plexus.
the class OneToManyAssociationVerifier method testProperty.
private void testProperty() {
ListSetMapProperties foo = new ListSetMapProperties();
String i1 = "1";
String i2 = "2";
Person person1 = new Person();
Person person2 = new Person();
foo.addProperty(i1, person1);
Assert.assertEquals("properties.size", 1, foo.getProperties().size());
foo.addProperty(i1, person1);
Assert.assertEquals("properties.size", 1, foo.getProperties().size());
foo.addProperty(i2, person2);
Assert.assertEquals("properties.size", 2, foo.getProperties().size());
}
use of sqlite.feature.many2many.case7.Person in project modello by codehaus-plexus.
the class OneToManyAssociationVerifier method verify.
public void verify() {
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
Person person = new Person();
Location location = new Location();
location.getPersons().add(person);
Assert.assertNotNull("Location.persons == null", location.getPersons());
Assert.assertEquals("Location.persons.length != 1", 1, location.getPersons().size());
Assert.assertEquals("Location.persons[0]", person, location.getPersons().get(0));
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
person = new Person();
location = new Location();
person.setLocation(location);
Assert.assertNotNull("Location.persons == null", location.getPersons());
Assert.assertEquals("Location.persons.length != 1", 1, location.getPersons().size());
Assert.assertEquals("Location.persons[0]", person, location.getPersons().get(0));
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
testList();
testMap();
testProperty();
testSet();
}
use of sqlite.feature.many2many.case7.Person in project modello by codehaus-plexus.
the class InterfaceAssociationVerifier method verify.
public void verify() throws Exception {
Location location = new Location();
IPerson person = new Person();
// check List<IPerson> persons attribute getters/setters
location.addPerson(person);
List<IPerson> persons = location.getPersons();
location.setPersons(new ArrayList<IPerson>(persons));
location.removePerson(person);
// check Set<IPerson> relatives attribute getters/setters
location.addRelative(person);
Set<IPerson> relatives = location.getRelatives();
location.setRelatives(new HashSet<IPerson>(relatives));
location.removeRelative(person);
IPerson mother = new Person();
location.setMother(mother);
Assert.assertNotNull(location.getMother());
location.setMother(null);
Assert.assertNull(location.getMother());
}
use of sqlite.feature.many2many.case7.Person in project universal-db by teamapps-org.
the class DeleteTest method testDeleteRecord.
@Test
public void testDeleteRecord() {
Person.getAll().forEach(p -> p.delete());
Person p1 = Person.create().setLastName("p1").save();
assertTrue(p1.isStored());
assertEquals(1, Person.getCount());
p1.delete();
assertEquals(0, Person.getCount());
assertFalse(p1.isStored());
}
Aggregations