package org.wikier.trioo.jtrioo;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.wikier.trioo.jtrioo.helpers.JTriooHelper;
import org.wikier.trioo.jtrioo.models.SimplePerson;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import com.hp.hpl.jena.rdf.model.Model;
public class RelationTest {
private static final String SERIALIZATION = "RDF/XML-ABBREV";
private SimplePerson person;
@Before
public void before() {
this.person = new SimplePerson();
this.person.setName("Alice");
SimplePerson rel = new SimplePerson();
rel.setName("Bob");
this.person.setRel(rel);
}
@After
public void after() {
this.person = null;
}
@Test
public void testDescribe() {
Model model = JTriooHelper.describe(this.person);
long size = model.size();
assertTrue(size > 0);
assertEquals(3, size);
model.write(System.out, SERIALIZATION);
}
@Test
public void testDescribeTwice() {
Model model = JTriooHelper.describe(this.person);
long size = model.size();
assertTrue(size > 0);
assertEquals(3, size);
model = JTriooHelper.describe(this.person, model);
size = model.size();
assertTrue(size > 0);
assertEquals(3, size);
model.write(System.out, SERIALIZATION);
}
}