X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=test%2Fjalview%2Furls%2FUrlLinkDisplayTest.java;h=efa645715ed2a3c360a61ea12bfbe8e85e2f2ae8;hb=c65445117a90cba697ba60628971cf1c46cfb320;hp=e8a585c01d2dd1a7ee1fb3fac3a7e102c7e73439;hpb=40f8e76e5d28e2c2fe5fddab72fe797a696bed8a;p=jalview.git diff --git a/test/jalview/urls/UrlLinkDisplayTest.java b/test/jalview/urls/UrlLinkDisplayTest.java index e8a585c..efa6457 100644 --- a/test/jalview/urls/UrlLinkDisplayTest.java +++ b/test/jalview/urls/UrlLinkDisplayTest.java @@ -1,3 +1,23 @@ +/* + * 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.urls; import jalview.util.UrlLink; @@ -7,7 +27,8 @@ import java.util.List; import org.testng.Assert; import org.testng.annotations.Test; -public class UrlLinkDisplayTest { +public class UrlLinkDisplayTest +{ @Test(groups = { "Functional" }) public void testDisplayColumnNames() @@ -20,16 +41,14 @@ public class UrlLinkDisplayTest { @Test(groups = { "Functional" }) public void getValue() { - UrlLink link = new UrlLink("Test Url", - "http://identifiers.org/$DB_ACCESSION$", - "TestName"); + UrlLink link = new UrlLink("Test Name", + "http://identifiers.org/$DB_ACCESSION$", "TestDB"); UrlLinkDisplay u = new UrlLinkDisplay("Test", link, false, false); Assert.assertFalse((boolean) u.getValue(UrlLinkDisplay.PRIMARY)); Assert.assertEquals(u.getValue(UrlLinkDisplay.ID), "Test"); - Assert.assertEquals(u.getValue(UrlLinkDisplay.DATABASE), "Test Url"); - Assert.assertEquals(u.getValue(UrlLinkDisplay.NAME), - "TestName"); + Assert.assertEquals(u.getValue(UrlLinkDisplay.DATABASE), "TestDB"); + Assert.assertEquals(u.getValue(UrlLinkDisplay.NAME), "Test Name"); Assert.assertFalse((boolean) u.getValue(UrlLinkDisplay.SELECTED)); Assert.assertEquals(u.getValue(UrlLinkDisplay.URL), "http://identifiers.org/$DB_ACCESSION$"); @@ -42,8 +61,7 @@ public class UrlLinkDisplayTest { // default only editable if link contains $SEQUENCE_ID$ UrlLink link = new UrlLink("Test Url", - "http://identifiers.org/$DB_ACCESSION$", - "TestName"); + "http://identifiers.org/$DB_ACCESSION$", "TestName"); UrlLinkDisplay u = new UrlLinkDisplay("Test", link, false, false); Assert.assertFalse(u.isEditable(UrlLinkDisplay.PRIMARY)); @@ -69,44 +87,42 @@ public class UrlLinkDisplayTest { public void testName() { UrlLink link = new UrlLink("Test Url", - "http://identifiers.org/$DB_ACCESSION$", - "TestName"); + "http://identifiers.org/$DB_ACCESSION$", "TestName"); UrlLinkDisplay u = new UrlLinkDisplay("Test", link, false, false); // Name initially as input in link - Assert.assertEquals(u.getName(), "Test Url"); + Assert.assertEquals(u.getDBName(), "TestName"); // Setting updates name - u.setName("New Name"); - Assert.assertEquals(u.getName(), "New Name"); + u.setDBName("NewName"); + Assert.assertEquals(u.getDBName(), "NewName"); } @Test(groups = { "Functional" }) public void testDescription() { - UrlLink link = new UrlLink("Test Url", - "http://identifiers.org/$DB_ACCESSION$", - "TestName"); + UrlLink link = new UrlLink("Test Name", + "http://identifiers.org/$DB_ACCESSION$", "TestDB"); UrlLinkDisplay u = new UrlLinkDisplay("Test", link, false, false); // Desc initially as input in link - Assert.assertEquals(u.getDBName(), "TestName"); + Assert.assertEquals(u.getDescription(), "Test Name"); // Setting updates name u.setDescription("New Desc"); - Assert.assertEquals(u.getDBName(), "New Desc"); + Assert.assertEquals(u.getDescription(), "New Desc"); } @Test(groups = { "Functional" }) public void testUrl() { - UrlLink link = new UrlLink("Test Url", - "http://identifiers.org/$DB_ACCESSION$", - "TestName"); + UrlLink link = new UrlLink("Test Name", + "http://identifiers.org/$DB_ACCESSION$", "TestDB"); UrlLinkDisplay u = new UrlLinkDisplay("Test", link, false, false); // Url initially as input in link - Assert.assertEquals(u.getUrl(), "http://identifiers.org/$DB_ACCESSION$"); + Assert.assertEquals(u.getUrl(), + "http://identifiers.org/$DB_ACCESSION$"); // Setting updates url u.setUrl("http://something.new/$SEQUENCE_ID$"); @@ -116,16 +132,14 @@ public class UrlLinkDisplayTest { @Test(groups = { "Functional" }) public void testGetSetValue() { - UrlLink link = new UrlLink("Test Url", - "http://identifiers.org/$DB_ACCESSION$", - "TestName"); + UrlLink link = new UrlLink("Test Name", + "http://identifiers.org/$DB_ACCESSION$", "TestDB"); UrlLinkDisplay u = new UrlLinkDisplay("Test", link, false, false); Assert.assertFalse((boolean) u.getValue(UrlLinkDisplay.PRIMARY)); Assert.assertFalse((boolean) u.getValue(UrlLinkDisplay.SELECTED)); - Assert.assertEquals(u.getValue(UrlLinkDisplay.DATABASE), "Test Url"); - Assert.assertEquals(u.getValue(UrlLinkDisplay.NAME), - "TestName"); + Assert.assertEquals(u.getValue(UrlLinkDisplay.DATABASE), "TestDB"); + Assert.assertEquals(u.getValue(UrlLinkDisplay.NAME), "Test Name"); Assert.assertEquals(u.getValue(UrlLinkDisplay.ID), "Test"); Assert.assertEquals(u.getValue(UrlLinkDisplay.URL), "http://identifiers.org/$DB_ACCESSION$"); @@ -138,9 +152,10 @@ public class UrlLinkDisplayTest { u.setValue(UrlLinkDisplay.NAME, "New Desc"); Assert.assertEquals(u.getValue(UrlLinkDisplay.NAME), "New Desc"); + Assert.assertEquals(u.getValue(UrlLinkDisplay.DATABASE), "New Desc"); - u.setValue(UrlLinkDisplay.DATABASE, "New Name"); - Assert.assertEquals(u.getValue(UrlLinkDisplay.DATABASE), "New Name"); + u.setValue(UrlLinkDisplay.DATABASE, "NewName"); + Assert.assertEquals(u.getValue(UrlLinkDisplay.DATABASE), "NewName"); u.setValue(UrlLinkDisplay.ID, "New ID"); Assert.assertEquals(u.getValue(UrlLinkDisplay.ID), "New ID");