X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fws%2Fdbsources%2FUniprotTest.java;fp=test%2Fjalview%2Fws%2Fdbsources%2FUniprotTest.java;h=67d5d62aa1b63fab19835a8c08cf4a7b9b17eb18;hb=389aee3db85ef6cbbe710f281000daa45edcc206;hp=ab79f104f43b0fbbd265a3f32fdb98d9f5c3591e;hpb=fb6e6ecaf1aa86750f84e833ff83471d3cbd526c;p=jalview.git 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