Package org.obolibrary.obo2owl

Source Code of org.obolibrary.obo2owl.RoundTripSynonymTest

package org.obolibrary.obo2owl;

import static org.junit.Assert.*;

import java.io.BufferedWriter;
import java.io.StringWriter;

import org.junit.Test;
import org.obolibrary.oboformat.model.Frame;
import org.obolibrary.oboformat.model.OBODoc;
import org.obolibrary.oboformat.writer.OBOFormatWriter;

@SuppressWarnings("javadoc")
public class RoundTripSynonymTest extends RoundTripTest {

    @Test
    public void testRoundTrip() throws Exception {
        roundTripOBOFile("synonym_test.obo", true);
    }

    @Test
    public void testRequireEmptyXrefList() throws Exception {
        OBODoc obo = parseOBOFile("synonym_test.obo");
        // Get synonym clause with an empty xref list
        Frame frame = obo.getTermFrame("GO:0009579");
        assertNotNull(frame);
        // write frame
        StringWriter stringWriter = new StringWriter();
        BufferedWriter bufferedWriter = new BufferedWriter(stringWriter);
        OBOFormatWriter oboWriter = new OBOFormatWriter();
        oboWriter.write(frame, bufferedWriter, null);
        bufferedWriter.flush();
        // get written frame
        String line = stringWriter.getBuffer().toString();
        // check that written frame has line:
        // synonym: "photosynthetic membrane" RELATED []
        assertTrue(line
                .contains("\nsynonym: \"photosynthetic membrane\" RELATED []\n"));
    }
}
TOP

Related Classes of org.obolibrary.obo2owl.RoundTripSynonymTest

TOP
Copyright © 2018 www.massapi.com. 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.