Update of /cvsroot/mockobjects/no-stone-unturned/src/nostone/junitrunner
In directory usw-pr-cvs1:/tmp/cvs-serv2888/src/nostone/junitrunner
Modified Files:
SwingRunner.java SwingRunnerTest.java
Log Message:
test two passing tests
Index: SwingRunner.java
===================================================================
RCS file: /cvsroot/mockobjects/no-stone-unturned/src/nostone/junitrunner/SwingRunner.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SwingRunner.java 17 Aug 2002 20:29:18 -0000 1.2
+++ SwingRunner.java 17 Aug 2002 20:31:42 -0000 1.3
@@ -22,13 +22,13 @@
JProgressBar progressBar = new JProgressBar();
progressBar.setName("progress bar");
progressBar.setForeground(Color.GREEN);
- progressBar.setValue(1);
- progressBar.setMaximum(1);
+ progressBar.setValue( test.countTestCases() );
+ progressBar.setMaximum( test.countTestCases() );
getContentPane().setLayout(new FlowLayout());
getContentPane().add(progressBar);
- addLabel("1", "total count");
- addLabel("1", "success count");
+ addLabel(Integer.toString(test.countTestCases()), "total count");
+ addLabel(Integer.toString(test.countTestCases()), "success count");
addLabel("0", "failure count");
addLabel("0", "error count");
getContentPane().add(quitButton);
Index: SwingRunnerTest.java
===================================================================
RCS file: /cvsroot/mockobjects/no-stone-unturned/src/nostone/junitrunner/SwingRunnerTest.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SwingRunnerTest.java 17 Aug 2002 20:29:18 -0000 1.3
+++ SwingRunnerTest.java 17 Aug 2002 20:31:42 -0000 1.4
@@ -63,6 +63,27 @@
checkLabelText("error count", "0");
}
+ public void testTwoPassingTests() {
+ runner = new SwingRunner( new Test() {
+ public int countTestCases() {
+ return 2;
+ }
+ public void run(TestResult result) {
+ result.endTest( this );
+ }
+ } );
+
+ JProgressBar progressBar = (JProgressBar)find("progress bar");
+ assertNotNull("should have progress bar", progressBar);
+ assertEquals("progress bar colour", Color.GREEN, progressBar.getForeground());
+ assertEquals("progress bar value", 2, progressBar.getValue());
+ assertEquals("progress bar max", 2, progressBar.getMaximum());
+
+ checkLabelText("total count", "2");
+ checkLabelText("success count", "2");
+ checkLabelText("failure count", "0");
+ checkLabelText("error count", "0");
+ }
private void checkLabelText(String name, String expectedText) {
JLabel label = (JLabel) find(name);
|