@Test public void test_write_interaction_registered() throws XMLStreamException, IOException, IllegalRangeException { BinaryInteractionEvidence interaction = new DefaultNamedBinaryInteractionEvidence(); ParticipantEvidence participant = new DefaultNamedParticipantEvidence(InteractorUtils.createUnknownBasicInteractor()); interaction.addParticipant(participant); elementCache.clear(); elementCache.extractIdForInteraction(new DefaultInteraction()); elementCache.extractIdForInteraction(interaction); XmlNamedBinaryInteractionEvidenceWriter writer = new XmlNamedBinaryInteractionEvidenceWriter(createStreamWriter(), this.elementCache); writer.write(interaction); streamWriter.flush(); Assert.assertEquals(this.interaction_registered, output.toString()); }
@Test public void test_write_participant_complex_no_participants() throws XMLStreamException, IOException, IllegalRangeException { BinaryInteractionEvidence interaction = new DefaultNamedBinaryInteractionEvidence(); Complex complex = new DefaultComplex("test complex"); ParticipantEvidence participant = new DefaultNamedParticipantEvidence(complex); interaction.addParticipant(participant); elementCache.clear(); XmlNamedBinaryInteractionEvidenceWriter writer = new XmlNamedBinaryInteractionEvidenceWriter(createStreamWriter(), this.elementCache); writer.write(interaction); streamWriter.flush(); Assert.assertEquals(this.interaction, output.toString()); }
@Test public void test_write_interaction_type() throws XMLStreamException, IOException, IllegalRangeException { BinaryInteractionEvidence interaction = new DefaultNamedBinaryInteractionEvidence(); ParticipantEvidence participant = new DefaultNamedParticipantEvidence(InteractorUtils.createUnknownBasicInteractor()); interaction.addParticipant(participant); interaction.setInteractionType(CvTermUtils.createMICvTerm("association", "MI:0914")); elementCache.clear(); XmlNamedInteractionEvidenceWriter writer = new XmlNamedInteractionEvidenceWriter(createStreamWriter(), this.elementCache); writer.write(interaction); streamWriter.flush(); Assert.assertEquals(this.interaction_type, output.toString()); }
@Test public void test_write_interaction_fullName() throws XMLStreamException, IOException, IllegalRangeException { NamedInteraction interaction = new DefaultNamedBinaryInteractionEvidence(); interaction.setFullName("interaction test"); ParticipantEvidence participant = new DefaultNamedParticipantEvidence(InteractorUtils.createUnknownBasicInteractor()); interaction.addParticipant(participant); elementCache.clear(); XmlNamedBinaryInteractionEvidenceWriter writer = new XmlNamedBinaryInteractionEvidenceWriter(createStreamWriter(), this.elementCache); writer.write((BinaryInteractionEvidence) interaction); streamWriter.flush(); Assert.assertEquals(this.interaction_fullName, output.toString()); }
@Test public void test_write_interaction_xref() throws XMLStreamException, IOException, IllegalRangeException { BinaryInteractionEvidence interaction = new DefaultNamedBinaryInteractionEvidence(); ParticipantEvidence participant = new DefaultNamedParticipantEvidence(InteractorUtils.createUnknownBasicInteractor()); interaction.addParticipant(participant); interaction.getXrefs().add(new DefaultXref(new DefaultCvTerm("test2"), "xxxx2")); interaction.getXrefs().add(new DefaultXref(new DefaultCvTerm("test"), "xxxx1")); elementCache.clear(); XmlNamedBinaryInteractionEvidenceWriter writer = new XmlNamedBinaryInteractionEvidenceWriter(createStreamWriter(), this.elementCache); writer.write(interaction); streamWriter.flush(); Assert.assertEquals(this.interaction_xref, output.toString()); }
@Test public void test_write_interaction_attributes() throws XMLStreamException, IOException, IllegalRangeException { BinaryInteractionEvidence interaction = new DefaultNamedBinaryInteractionEvidence(); ParticipantEvidence participant = new DefaultNamedParticipantEvidence(InteractorUtils.createUnknownBasicInteractor()); interaction.addParticipant(participant); interaction.getAnnotations().add(new DefaultAnnotation(new DefaultCvTerm("test2"))); interaction.getAnnotations().add(new DefaultAnnotation(new DefaultCvTerm("test3"))); interaction.setComplexExpansion(CvTermUtils.createMICvTerm("spoke expansion", "MI:1060")); elementCache.clear(); XmlNamedBinaryInteractionEvidenceWriter writer = new XmlNamedBinaryInteractionEvidenceWriter(createStreamWriter(), this.elementCache); writer.write(interaction); streamWriter.flush(); Assert.assertEquals(this.interaction_attributes, output.toString()); }
@Test @Ignore public void test_write_interaction_inferred() throws XMLStreamException, IOException, IllegalRangeException { BinaryInteractionEvidence interaction = new DefaultNamedBinaryInteractionEvidence(); ParticipantEvidence participant = new DefaultNamedParticipantEvidence(InteractorUtils.createUnknownBasicInteractor()); ParticipantEvidence participant2 = new DefaultNamedParticipantEvidence(InteractorUtils.createUnknownBasicInteractor()); ParticipantEvidence participant3 = new DefaultNamedParticipantEvidence(InteractorUtils.createUnknownBasicInteractor()); ParticipantEvidence participant4 = new DefaultNamedParticipantEvidence(InteractorUtils.createUnknownBasicInteractor()); // two inferred interactiosn f1, f2, f3 and f3,f4 FeatureEvidence f1 = new DefaultFeatureEvidence(); f1.getRanges().add(RangeUtils.createRangeFromString("1-4")); FeatureEvidence f2 = new DefaultFeatureEvidence(); f2.getRanges().add(RangeUtils.createRangeFromString("1-4")); FeatureEvidence f3 = new DefaultFeatureEvidence(); f1.getLinkedFeatures().add(f2); f1.getLinkedFeatures().add(f3); f2.getLinkedFeatures().add(f1); f2.getLinkedFeatures().add(f3); f3.getLinkedFeatures().add(f1); f3.getLinkedFeatures().add(f2); participant.addFeature(f1); participant2.addFeature(f2); participant3.addFeature(f3); interaction.addParticipant(participant); interaction.addParticipant(participant2); elementCache.clear(); XmlNamedBinaryInteractionEvidenceWriter writer = new XmlNamedBinaryInteractionEvidenceWriter(createStreamWriter(), this.elementCache); writer.write(interaction); streamWriter.flush(); Assert.assertEquals(this.interaction_inferred, output.toString()); }