From: gmungoc Date: Wed, 6 Jun 2018 15:47:55 +0000 (+0100) Subject: JAL-2920 unit tests for 3 or more original or variant bases X-Git-Tag: Release_2_10_5~57 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=389aee3db85ef6cbbe710f281000daa45edcc206;p=jalview.git JAL-2920 unit tests for 3 or more original or variant bases --- diff --git a/test/jalview/ws/dbsources/UniprotTest.java b/test/jalview/ws/dbsources/UniprotTest.java index ab79f10..67d5d62 100644 --- a/test/jalview/ws/dbsources/UniprotTest.java +++ b/test/jalview/ws/dbsources/UniprotTest.java @@ -248,14 +248,39 @@ public class UniprotTest uf.setPosition(23); uf.setOriginal("K"); - Vector vars = new Vector(); + Vector vars = new Vector<>(); vars.add("y"); uf.setVariation(vars); assertEquals("p.Lys23Tyr Hello", Uniprot.getDescription(uf)); + vars.add("W"); + assertEquals("p.Lys23Tyr\np.Lys23Trp Hello", + Uniprot.getDescription(uf)); + + /* + * indel cases + * up to 3 bases (original or variant) are shown using 3 letter code + */ + vars.clear(); + vars.add("KWE"); + uf.setOriginal("KLS"); + assertEquals( + "p.LysLeuSer23LysTrpGlu Hello", + Uniprot.getDescription(uf)); + + // adding a fourth original base switches to single letter code + uf.setOriginal("KLST"); + assertEquals("p.KLST23LysTrpGlu Hello", + Uniprot.getDescription(uf)); + + // adding a fourth variant switches to a condensed representation + vars.clear(); + vars.add("KWES"); + assertEquals("p.KLST23KWES Hello", Uniprot.getDescription(uf)); + vars.clear(); vars.add("z"); // unknown variant - fails gracefully - uf.setVariation(vars); + uf.setOriginal("K"); assertEquals("p.Lys23z Hello", Uniprot.getDescription(uf)); uf.setVariation(null); // variant missing - is ignored