@@ -0,0 +1,2079 @@
+package org.cipres.treebase.domain.nexus;%0A%0Aimport junit.framework.Assert;%0A%0Aimport org.cipres.treebase.dao.AbstractDAOTest;%0Aimport org.cipres.treebase.domain.matrix.CharacterMatrix;%0Aimport org.cipres.treebase.domain.nexus.nexml.NexmlMatrixConverter;%0Aimport org.cipres.treebase.domain.nexus.NexusDataSet;%0Aimport org.cipres.treebase.domain.study.Study;%0Aimport org.cipres.treebase.domain.taxon.TaxonLabelHome;%0Aimport org.nexml.model.DocumentFactory;%0Aimport org.nexml.model.Document;%0A%0Apublic class NexmlMatrixConverterTest extends AbstractDAOTest %7B%0A%09private TaxonLabelHome mTaxonLabelHome;%0A%0A%09/**%0A%09 * Test  for %7B@link org.cipres.treebase.domain.nexus.nexml.NexmlMatrixConverter#fromTreeBaseToXml(CharacterMatrix)%7D.%0A%09 */%0A%09public void testNexmlMatrixConverter() %7B%0A%09%09String testName = %22testNexmlMatrixConverter%22;%0A%09%09//signal beginning of test%0A%09%09if (logger.isInfoEnabled()) %7B%0A%09%09%09logger.info(%22%5Cn%5Ct%5CtRunning Test: %22 + testName);%0A%09%09%7D%0A%09%09%0A%09%09long studyId = 1787;%0A%09%09Study study = (Study)loadObject(Study.class, studyId);%0A%09%09NexusDataSet nexusDataSet = new NexusDataSet();%0A%09%09%0A%09%09Document doc = DocumentFactory.safeCreateDocument();%0A%09%09nexusDataSet.setNexmlProject(doc);%0A%09%09NexmlMatrixConverter nmc = new NexmlMatrixConverter(study,getTaxonLabelHome(),doc);%0A%09%09for (org.cipres.treebase.domain.matrix.Matrix matrix : nexusDataSet.getMatrices() ) %7B%0A%09%09%09if ( matrix instanceof CharacterMatrix ) %7B%0A%09%09%09%09//fromTreeBaseToXml(CharacterMatrix) is main method being tested here--it uses populateXmlMatrix() function%0A%09%09%09%09String xml = ((Document) nmc.fromTreeBaseToXml((CharacterMatrix)matrix)).getXmlString();%0A%09%09%09%09System.out.println(xml);%0A%09%09%09%09Assert.assertNotNull(xml);%0A%09%09%09%7D%0A%09%09%7D%0A%09%09//signal that test is over%0A%09%09if (logger.isInfoEnabled()) %7B%0A%09%09%09logger.info(testName + %22 - end %22);%0A%09%09%7D%0A%09%7D%0A%09%0A%09/**%0A%09 * Return the TaxonLabelHome field.%0A%09 * %0A%09 * @return TaxonLabelHome mTaxonLabelHome%0A%09 */%0A%09public TaxonLabelHome getTaxonLabelHome() %7B%0A%09%09return mTaxonLabelHome;%0A%09%7D%0A%0A%09/**%0A%09 * Set the TaxonLabelHome field.%0A%09 */%0A%09public void setTaxonLabelHome(TaxonLabelHome pNewTaxonLabelHome) %7B%0A%09%09mTaxonLabelHome = pNewTaxonLabelHome;%0A%09%7D%09%0A%0A%7D%0A

Test for NexmlMatrixConverter class for function fromTreeBaseToXml(CharacterMatrix). This is the function that calls the poplulateXmlMatrix() function