X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fgui%2FProgressBarTest.java;h=a1715e96d811dac7910b5ca0ccb2b6c8317f5457;hb=29c183b0d0de9f6f9f94d2b528d10e20b1891684;hp=2d3db6832f9e1b3b6f0852e30ed1a5c958bd2a4d;hpb=b889ea425e373a429b24e7eb2b2e3d4b6ad766dc;p=jalview.git diff --git a/test/jalview/gui/ProgressBarTest.java b/test/jalview/gui/ProgressBarTest.java index 2d3db68..a1715e9 100644 --- a/test/jalview/gui/ProgressBarTest.java +++ b/test/jalview/gui/ProgressBarTest.java @@ -1,8 +1,27 @@ +/* + * 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.gui; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.testng.AssertJUnit.assertEquals; +import static org.testng.AssertJUnit.assertTrue; import java.awt.Component; import java.awt.FlowLayout; @@ -11,29 +30,38 @@ import java.awt.GridLayout; import javax.swing.JLabel; import javax.swing.JPanel; -import org.junit.Test; +import org.testng.Assert; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; public class ProgressBarTest { + @BeforeClass(alwaysRun = true) + public void setUpJvOptionPane() + { + JvOptionPane.setInteractiveMode(false); + JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); + } + private JPanel statusPanel; private JLabel statusBar; - @Test + @Test(groups = { "Functional" }) public void testConstructor_prematureInstantiation() { try { new ProgressBar(null, null); - fail("Expected exception"); + Assert.fail("Expected exception"); } catch (NullPointerException e) { // expected } } - @Test + @Test(groups = { "Functional" }) public void testConstructor_wrongLayout() { statusPanel = new JPanel(); @@ -41,14 +69,14 @@ public class ProgressBarTest try { new ProgressBar(statusPanel, null); - fail("expected exception"); + Assert.fail("expected exception"); } catch (IllegalArgumentException e) { // expected } } - @Test + @Test(groups = { "Functional" }) public void testSetProgressBar() { statusPanel = new JPanel(); @@ -61,30 +89,26 @@ public class ProgressBarTest * Add 'hello' */ pb.setProgressBar("hello", 1L); - verifyProgress(layout, new String[] - { "hello" }); + verifyProgress(layout, new String[] { "hello" }); /* * Add 'world' */ pb.setProgressBar("world", 2L); - verifyProgress(layout, new String[] - { "hello", "world" }); + verifyProgress(layout, new String[] { "hello", "world" }); /* * Remove 'hello' with no status bar update */ pb.setProgressBar(null, 1L); - verifyProgress(layout, new String[] - { "world" }); + verifyProgress(layout, new String[] { "world" }); assertEquals("nothing", statusBar.getText()); /* * Remove 'world' with status bar update */ pb.setProgressBar("goodbye", 2L); - verifyProgress(layout, new String[] - {}); + verifyProgress(layout, new String[] {}); assertEquals("goodbye", statusBar.getText()); }