Package org.gedcom4j.model

Examples of org.gedcom4j.model.Individual


     * {@link RelationshipCalculator#calculateRelationships(org.gedcom4j.model.Individual, org.gedcom4j.model.Individual, boolean)}
     * .
     */
    @Test
    public void testCalculateRelationshipSonFather() {
        Individual james = getPerson("Andrews", "James");
        Individual robert = getPerson("Andrews", "Robert");

        rc.calculateRelationships(robert, james, true);
        assertNotNull(rc.relationshipsFound);
        if (VERBOSE) {
            System.out.println("Relationships between " + robert + " and " + james);
View Full Code Here


     * @param givenName
     *            the given name of the person we want
     * @return the person
     */
    private Individual getPerson(String surname, String givenName) {
        Individual result = finder.findByName(surname, givenName).get(0);
        assertNotNull("Couldn't find " + givenName + " " + surname + " by name in the gedcom", result);
        return result;
    }
View Full Code Here

        gp.load("sample/Event Tag Test.ged");
        Gedcom gBefore = gp.gedcom;
        assertNotNull(gBefore);

        assertEquals(1, gBefore.individuals.size());
        Individual iBefore = gBefore.individuals.get("@I1@");
        assertNotNull(iBefore);

        assertNotNull(iBefore.events);
        assertEquals(4, iBefore.events.size());
        IndividualEvent eBefore = iBefore.events.get(0); // The birth event
        assertNotNull(eBefore);
        assertEquals(IndividualEventType.BIRTH, eBefore.type);
        assertNull(eBefore.yNull);
        assertNotNull(eBefore.description);

        // Write the file back out in standard format
        String fn = "tmp/" + this.getClass().getName() + ".ged";
        GedcomWriter gw = new GedcomWriter(gBefore);
        gw.validationSuppressed = true;
        gw.write(fn);

        // Read the file we just wrote back in. The non-standard part should be removed.
        gp = new GedcomParser();
        gp.load(fn);
        Gedcom gAfter = gp.gedcom;
        assertNotNull(gBefore);

        assertEquals(1, gAfter.individuals.size());
        Individual iAfter = gAfter.individuals.get("@I1@");
        assertNotNull(iAfter);

        assertNotNull(iAfter.events);
        assertEquals(4, iAfter.events.size());
        IndividualEvent eAfter = iAfter.events.get(0); // The birth event
View Full Code Here

        gp.load("sample/Event Tag Test.ged");
        Gedcom gBefore = gp.gedcom;
        assertNotNull(gBefore);

        assertEquals(1, gBefore.individuals.size());
        Individual iBefore = gBefore.individuals.get("@I1@");
        assertNotNull(iBefore);

        assertNotNull(iBefore.events);
        assertEquals(4, iBefore.events.size());
        IndividualEvent eBefore = iBefore.events.get(0); // The birth event
View Full Code Here

    /**
     * Test the {@link AncestryCalculator#getExtendedAncestry(Individual)} method
     */
    @Test
    public void testExtendedAncestors1() {
        Individual alex = getPerson("Zucco", "Alex");
        Set<Individual> extendedAncestry = anc.getExtendedAncestry(alex);
        assertNotNull(extendedAncestry);
        assertEquals("Alex has 20 ancestors (including 1 step!) in the gedcom", 20, extendedAncestry.size());
    }
View Full Code Here

    /**
     * Test the {@link AncestryCalculator#getExtendedAncestry(Individual)} method
     */
    @Test
    public void testExtendedAncestors2() {
        Individual james = getPerson("Andrews", "James");
        Set<Individual> extendedAncestry = anc.getExtendedAncestry(james);
        assertNotNull(extendedAncestry);
        assertEquals("James Andrews has no ancestors in the gedcom", 0, extendedAncestry.size());
    }
View Full Code Here

    /**
     * Test the {@link AncestryCalculator#getExtendedAncestry(Individual)} method
     */
    @Test
    public void testExtendedAncestors3() {
        Individual sylvia = getPerson("Jackson", "Sylvia");
        Set<Individual> extendedAncestry = anc.getExtendedAncestry(sylvia);
        assertNotNull(extendedAncestry);
        assertEquals("Sylvia Jackson has 3 ancestors in the gedcom", 3, extendedAncestry.size());
    }
View Full Code Here

     * Test extended ancestors for a parent-child relationship - the parent's ancestors are the child's, but not all the
     * child's ancestors are the parent's
     */
    @Test
    public void testExtendedAncestors4() {
        Individual robert = getPerson("Andrews", "Robert");
        Individual theresa = getPerson("Andrews", "Theresa");

        Set<Individual> robertAncestors = anc.getExtendedAncestry(robert);
        if (VERBOSE) {
            System.out.println("Ancestors of Robert Andrews");
            dumpIndividuals(robertAncestors);
View Full Code Here

    /**
     * Test when people are siblings.
     */
    @Test
    public void testGenerationCount0() {
        Individual sally = getPerson("Struthers", "Sally");
        // Sammy is Sally's brother
        Individual sammy = getPerson("Struthers", "Sammy");
        assertNotNull(sally);
        assertNotNull(sammy);
        try {
            anc.getGenerationCount(sammy, sally);
            fail("Expected an IllegalArgumentException since sally is not an ancestor of sammy - they are brother and sister");
View Full Code Here

    /**
     * Test when people are 1 generation apart. Includes negative test where the ancestor/descendant are swapped.
     */
    @Test
    public void testGenerationCount1() {
        Individual sally = getPerson("Struthers", "Sally");
        Individual steven = getPerson("Struthers", "Steven");
        assertNotNull(sally);
        assertNotNull(steven);
        assertEquals(1, anc.getGenerationCount(sally, steven));
        try {
            anc.getGenerationCount(steven, sally);
View Full Code Here

TOP

Related Classes of org.gedcom4j.model.Individual

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.