X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=test%2Fjalview%2Fio%2FSequenceAnnotationReportTest.java;h=28958748720c559c1623e70116ff6a0e3e624ea9;hb=717215fa552eba980616292d76cd0032c548e459;hp=f5515718539f9c7b2455d4e0a474a87187f9c069;hpb=5aa038bdff10329d3b895dceb8d6f5161820a55c;p=jalview.git diff --git a/test/jalview/io/SequenceAnnotationReportTest.java b/test/jalview/io/SequenceAnnotationReportTest.java index f551571..2895874 100644 --- a/test/jalview/io/SequenceAnnotationReportTest.java +++ b/test/jalview/io/SequenceAnnotationReportTest.java @@ -1,21 +1,51 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. + */ package jalview.io; import static org.testng.AssertJUnit.assertEquals; import jalview.datamodel.SequenceFeature; +import jalview.gui.JvOptionPane; import java.util.Hashtable; import java.util.Map; +import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; public class SequenceAnnotationReportTest { + + @BeforeClass(alwaysRun = true) + public void setUpJvOptionPane() + { + JvOptionPane.setInteractiveMode(false); + JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); + } + @Test(groups = "Functional") public void testAppendFeature_disulfideBond() { SequenceAnnotationReport sar = new SequenceAnnotationReport(null); - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append("123456"); SequenceFeature sf = new SequenceFeature("disulfide bond", "desc", 1, 3, 1.2f, "group"); @@ -40,11 +70,11 @@ public class SequenceAnnotationReportTest public void testAppendFeature_status() { SequenceAnnotationReport sar = new SequenceAnnotationReport(null); - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); SequenceFeature sf = new SequenceFeature("METAL", "Fe2-S", 1, 3, Float.NaN, "group"); sf.setStatus("Confirmed"); - + sar.appendFeature(sb, 1, null, sf); assertEquals("METAL 1 3; Fe2-S; (Confirmed)", sb.toString()); } @@ -53,7 +83,7 @@ public class SequenceAnnotationReportTest public void testAppendFeature_withScore() { SequenceAnnotationReport sar = new SequenceAnnotationReport(null); - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); SequenceFeature sf = new SequenceFeature("METAL", "Fe2-S", 1, 3, 1.3f, "group"); @@ -86,10 +116,10 @@ public class SequenceAnnotationReportTest public void testAppendFeature_noScore() { SequenceAnnotationReport sar = new SequenceAnnotationReport(null); - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); SequenceFeature sf = new SequenceFeature("METAL", "Fe2-S", 1, 3, Float.NaN, "group"); - + sar.appendFeature(sb, 1, null, sf); assertEquals("METAL 1 3; Fe2-S", sb.toString()); } @@ -98,11 +128,11 @@ public class SequenceAnnotationReportTest public void testAppendFeature_clinicalSignificance() { SequenceAnnotationReport sar = new SequenceAnnotationReport(null); - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); SequenceFeature sf = new SequenceFeature("METAL", "Fe2-S", 1, 3, Float.NaN, "group"); sf.setValue("clinical_significance", "Benign"); - + sar.appendFeature(sb, 1, null, sf); assertEquals("METAL 1 3; Fe2-S; Benign", sb.toString()); } @@ -111,7 +141,7 @@ public class SequenceAnnotationReportTest public void testAppendFeature_withScoreStatusClinicalSignificance() { SequenceAnnotationReport sar = new SequenceAnnotationReport(null); - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); SequenceFeature sf = new SequenceFeature("METAL", "Fe2-S", 1, 3, 1.3f, "group"); sf.setStatus("Confirmed"); @@ -128,10 +158,10 @@ public class SequenceAnnotationReportTest public void testAppendFeature_DescEqualsType() { SequenceAnnotationReport sar = new SequenceAnnotationReport(null); - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); SequenceFeature sf = new SequenceFeature("METAL", "METAL", 1, 3, Float.NaN, "group"); - + // description is not included if it duplicates type: sar.appendFeature(sb, 1, null, sf); assertEquals("METAL 1 3", sb.toString()); @@ -147,15 +177,14 @@ public class SequenceAnnotationReportTest public void testAppendFeature_stripHtml() { SequenceAnnotationReport sar = new SequenceAnnotationReport(null); - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); SequenceFeature sf = new SequenceFeature("METAL", "helloworld", 1, 3, Float.NaN, "group"); - + sar.appendFeature(sb, 1, null, sf); // !! strips off but not ?? - assertEquals("METAL 1 3; helloworld", - sb.toString()); + assertEquals("METAL 1 3; helloworld", sb.toString()); sb.setLength(0); sf.setDescription("
&kHD>6");