Package org.gedcom4j.model

Examples of org.gedcom4j.model.Gedcom


    @Test
    public void testIssue61Loose() throws IOException, GedcomParserException {
        GedcomParser gp = new GedcomParser();
        gp.strictCustomTags = false;
        gp.load("sample/Harry_Potter.ged");
        Gedcom g = gp.gedcom;
        assertNotNull(g);
        assertTrue(gp.errors.isEmpty());
        for (Individual i : g.individuals.values()) {
            assertNotNull(i);
            assertNotNull(i.customTags);
View Full Code Here


     * Test for {@link GedcomValidator#validateIndividuals()} with a malformed
     * xref on an individual, which does not match its key in the individuals
     * map
     */
    public void testValidateIndividuals2() {
        Gedcom g = TestHelper.getMinimalGedcom();

        // Deliberately introduce a problem
        Individual i = new Individual();
        i.xref = "FryingPan";
        g.individuals.put("WrongKey", i);
View Full Code Here

    @Test
    public void testIssue61Strict() throws IOException, GedcomParserException {
        GedcomParser gp = new GedcomParser();
        gp.strictCustomTags = true;
        gp.load("sample/Harry_Potter.ged");
        Gedcom g = gp.gedcom;
        assertNotNull(g);
        assertTrue(!gp.errors.isEmpty());
        for (String e : gp.errors) {
            // These are the bad tags that were deliberately introduced
            assertTrue(e.contains("WAND") || e.contains("MUGL"));
View Full Code Here

    @Test
    public void testNonStdTagsNotWritten() throws IOException, GedcomParserException, GedcomWriterException {
        // Read original non-standard file, find non-standard birth event, assert some pre-conditions
        GedcomParser gp = new GedcomParser();
        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);
View Full Code Here

    @Test
    public void testValidation() throws IOException, GedcomParserException, GedcomWriterException {
        // Read original non-standard file, find non-standard birth event, assert some pre-conditions
        GedcomParser gp = new GedcomParser();
        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);
View Full Code Here

     * {@inheritDoc}
     */
    @Override
    protected void setUp() throws Exception {
        super.setUp();
        gedcom = new Gedcom();
        rootValidator = new GedcomValidator(gedcom);
    }
View Full Code Here

    /**
     * Test autorepairing
     */
    public void testAutoRepair() {
        Gedcom g = new Gedcom();

        // Deliberately introduce error
        g.individuals = null;

        // Go validate
View Full Code Here

    /**
     * Test for character set in header
     */
    @Test
    public void testTrailer() {
        Gedcom g = new Gedcom();
        rootValidator.gedcom = g;
        rootValidator.autorepair = false;
        Submitter s = new Submitter();
        s.xref = "@SUBM0001@";
        s.name = new StringWithCustomTags("test");
View Full Code Here

     * Test for {@link GedcomValidator#validateIndividuals()} with default,
     * empty {@link Gedcom} structure.
     *
     */
    public void testValidateEmptyGedcom() {
        Gedcom g = new Gedcom();
        rootValidator = new GedcomValidator(g);
        verbose = true;
        rootValidator.validate();
        dumpFindings();
        assertTrue(
View Full Code Here

     * Test method for
     * {@link org.gedcom4j.model.Gedcom#equals(java.lang.Object)}.
     */
    @Test
    public void testEqualsObject() {
        Gedcom g1 = new Gedcom();
        assertEquals(g1, g1);
        Gedcom g2 = new Gedcom();
        assertEquals("objects are equal, so equals() should return true", g1,
                g2);
        g1.trailer = null;
        assertFalse(
                "objects are no longer equal, so equals() should return false",
View Full Code Here

TOP

Related Classes of org.gedcom4j.model.Gedcom

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.