Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

finished support for no-arg constructor.

tweaks to the Swing UI
  • Loading branch information...
commit 86b71cb1b9784a9b87c86b4f3f12632ae6773d1f 1 parent b6a023c
egamma authored
Showing with 218 additions and 309 deletions.
  1. +2 −1  .project
  2. +8 −12 junit/awtui/TestRunner.java
  3. BIN  junit/awtui/logo.gif
  4. BIN  junit/awtui/smalllogo.gif
  5. +10 −12 junit/framework/TestSuite.java
  6. +2 −5 junit/runner/LoadingTestCollector.java
  7. +13 −13 junit/runner/Version.java
  8. +1 −3 junit/samples/SimpleTest.java
  9. +0 −3  junit/samples/VectorTest.java
  10. +3 −3 junit/samples/money/IMoney.java
  11. +0 −3  junit/samples/money/MoneyTest.java
  12. +5 −5 junit/swingui/AboutDialog.java
  13. +13 −11 junit/swingui/CounterPanel.java
  14. +70 −15 junit/swingui/DefaultFailureDetailView.java
  15. +13 −13 junit/swingui/FailureRunView.java
  16. +14 −54 junit/swingui/ProgressBar.java
  17. +2 −1  junit/swingui/StatusLine.java
  18. +2 −3 junit/swingui/TestHierarchyRunView.java
  19. +1 −2  junit/swingui/TestRunView.java
  20. +27 −30 junit/swingui/TestRunner.java
  21. +2 −3 junit/swingui/TestSelector.java
  22. +2 −3 junit/swingui/TestSuitePanel.java
  23. +2 −2 junit/swingui/TestTreeModel.java
  24. +0 −3  junit/tests/WasRun.java
  25. +4 −12 junit/tests/extensions/ActiveTestTest.java
  26. +0 −3  junit/tests/extensions/ExceptionTestCaseTest.java
  27. +3 −6 junit/tests/extensions/ExtensionTest.java
  28. +3 −6 junit/tests/extensions/RepeatedTestTest.java
  29. +1 −5 junit/tests/framework/AssertTest.java
  30. +1 −5 junit/tests/framework/Failure.java
  31. +1 −4 junit/tests/framework/InheritedTestCase.java
  32. +0 −2  junit/tests/framework/NoTestCaseClass.java
  33. +0 −3  junit/tests/framework/NoTestCases.java
  34. +0 −3  junit/tests/framework/NotPublicTestCase.java
  35. +0 −3  junit/tests/framework/NotVoidTestCase.java
  36. +0 −3  junit/tests/framework/OneTestCase.java
  37. +0 −3  junit/tests/framework/OverrideTestCase.java
  38. +3 −3 junit/tests/framework/Success.java
  39. +1 −1  junit/tests/framework/SuiteTest.java
  40. +5 −11 junit/tests/framework/TestCaseTest.java
  41. +2 −7 junit/tests/framework/TestImplementorTest.java
  42. +1 −3 junit/tests/framework/TestListenerTest.java
  43. +0 −4 junit/tests/runner/BaseTestRunnerTest.java
  44. +0 −7 junit/tests/runner/SimpleTestCollectorTest.java
  45. +0 −4 junit/tests/runner/SorterTest.java
  46. +0 −4 junit/tests/runner/StackFilterTest.java
  47. +0 −3  junit/tests/runner/TestCaseClassLoaderTest.java
  48. +0 −3  junit/tests/runner/TextRunnerTest.java
  49. +1 −1  stylesheet.css
View
3  .project
@@ -15,4 +15,5 @@
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.team.cvs.core.cvsnature</nature>
</natures>
-</projectDescription>
+</projectDescription>
+
View
20 junit/awtui/TestRunner.java
@@ -1,14 +1,12 @@
package junit.awtui;
-import junit.framework.*;
-import junit.runner.*;
-
-import java.util.Vector;
-import java.lang.reflect.*;
import java.awt.*;
import java.awt.event.*;
-import java.awt.image.*;
-import java.io.*;
+import java.awt.image.ImageProducer;
+import java.util.Vector;
+
+import junit.framework.*;
+import junit.runner.*;
/**
* An AWT based user interface to run tests.
@@ -342,12 +340,10 @@ private void rerunTest(Test test) {
return;
}
Test reloadedTest= null;
+ TestCase rerunTest= (TestCase)test;
try {
- Class reloadedTestClass= getLoader().reload(test.getClass());
- Class[] classArgs= { String.class };
- Constructor constructor= reloadedTestClass.getConstructor(classArgs);
- Object[] args= new Object[]{((TestCase)test).getName()};
- reloadedTest= (Test)constructor.newInstance(args);
+ Class reloadedTestClass= getLoader().reload(test.getClass());
+ reloadedTest= TestSuite.createTest(reloadedTestClass, rerunTest.getName());
} catch(Exception e) {
showInfo("Could not reload "+ test.toString());
return;
View
BIN  junit/awtui/logo.gif
Deleted file not rendered
View
BIN  junit/awtui/smalllogo.gif
Deleted file not rendered
View
22 junit/framework/TestSuite.java
@@ -54,7 +54,7 @@ public TestSuite(Class theClass, String name) {
* Kanton Uri
*/
public TestSuite(final Class theClass) {
- fName= theClass.getName();
+ fName= theClass.getName();
try {
getTestConstructor(theClass); // Avoid generating multiple error messages
} catch (NoSuchMethodException e) {
@@ -108,27 +108,25 @@ private void addTestMethod(Method m, Vector names, Class theClass) {
if (! isPublicTestMethod(m)) {
if (isTestMethod(m))
addTest(warning("Test method isn't public: "+m.getName()));
- return;
return;
-
}
names.addElement(name);
addTest(createTest(theClass, name));
- }
-
+ }
+
static public Test createTest(Class theClass, String name) {
- Constructor c;
+ Constructor constructor;
try {
constructor= getTestConstructor(theClass);
} catch (NoSuchMethodException e) {
return warning("Class "+theClass.getName()+" has no public constructor TestCase(String name) or TestCase()");
}
- Object test;
- try {
+ Object test;
+ try {
if (constructor.getParameterTypes().length == 0) {
test= constructor.newInstance(new Object[0]);
if (test instanceof TestCase)
- ((TestCase) test).setName(name);
+ ((TestCase) test).setName(name);
} else {
test= constructor.newInstance(new Object[]{name});
}
@@ -143,7 +141,7 @@ public Test createTest(Class theClass, String name) throws IllegalArgumentExcept
}
/**
- * Converts the stack trace into a string
+ * Converts the stack trace into a string
*/
private static String exceptionToString(Throwable t) {
StringWriter stringWriter= new StringWriter();
@@ -167,7 +165,7 @@ public int countTestCases() {
/**
* Gets a constructor which takes a single String as
- * its argument or a no arg constructor.
+ * its argument or a no arg constructor.
*/
public static Constructor getTestConstructor(Class theClass) throws NoSuchMethodException {
Class[] args= { String.class };
@@ -253,7 +251,7 @@ public String getName() {
}
/**
- * Returns a test which will fail and log a warning message.
+ * Returns a test which will fail and log a warning message.
*/
private static Test warning(final String message) {
return new TestCase("warning") {
View
7 junit/runner/LoadingTestCollector.java
@@ -59,14 +59,11 @@ boolean hasSuiteMethod(Class testClass) {
}
boolean hasPublicConstructor(Class testClass) {
- Class[] args= { String.class };
- Constructor c= null;
try {
- c= testClass.getConstructor(args);
- } catch(Exception e) {
+ TestSuite.getTestConstructor(testClass);
+ } catch(NoSuchMethodException e) {
return false;
}
return true;
}
-
}
View
26 junit/runner/Version.java
@@ -1,14 +1,14 @@
-package junit.runner;
+package junit.runner;
+
+/**
+ * This class defines the current version of JUnit
+ */
+public class Version {
+ private Version() {
+ // don't instantiate
+ }
-/**
- * This class defines the current version of JUnit
- */
-public class Version {
- private Version() {
- // don't instantiate
- }
-
- public static String id() {
- return "@version@";
- }
-}
+ public static String id() {
+ return "3.7";
+ }
+}
View
4 junit/samples/SimpleTest.java
@@ -9,9 +9,7 @@
public class SimpleTest extends TestCase {
protected int fValue1;
protected int fValue2;
- public SimpleTest(String name) {
- super(name);
- }
+
protected void setUp() {
fValue1= 2;
fValue2= 3;
View
3  junit/samples/VectorTest.java
@@ -12,9 +12,6 @@
protected Vector fEmpty;
protected Vector fFull;
- public VectorTest(String name) {
- super(name);
- }
public static void main (String[] args) {
junit.textui.TestRunner.run (suite());
}
View
6 junit/samples/money/IMoney.java
@@ -13,12 +13,12 @@
* Adds a simple Money to this money. This is a helper method for
* implementing double dispatch
*/
- IMoney addMoney(Money m);
+ public abstract IMoney addMoney(Money m);
/**
* Adds a MoneyBag to this money. This is a helper method for
* implementing double dispatch
*/
- IMoney addMoneyBag(MoneyBag s);
+ public abstract IMoney addMoneyBag(MoneyBag s);
/**
* Tests whether this money is zero
*/
@@ -38,5 +38,5 @@
/**
* Append this to a MoneyBag m.
*/
- void appendTo(MoneyBag m);
+ public abstract void appendTo(MoneyBag m);
}
View
3  junit/samples/money/MoneyTest.java
@@ -11,9 +11,6 @@
private IMoney fMB1;
private IMoney fMB2;
- public MoneyTest(String name) {
- super(name);
- }
public static void main(String args[]) {
junit.textui.TestRunner.run(MoneyTest.class);
}
View
10 junit/swingui/AboutDialog.java
@@ -2,8 +2,8 @@
import java.awt.*;
import java.awt.event.*;
-import javax.swing.*;
+import javax.swing.*;
import junit.runner.*;
/**
@@ -19,15 +19,15 @@ public AboutDialog(JFrame parent) {
setTitle("About");
setLocationRelativeTo(parent);
- JButton button= new JButton("Close");
- button.addActionListener(
+ JButton close= new JButton("Close");
+ close.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
}
}
);
-
+ getRootPane().setDefaultButton(close);
JLabel label1= new JLabel("JUnit");
label1.setFont(new Font("dialog", Font.PLAIN, 36));
@@ -53,7 +53,7 @@ public void actionPerformed(ActionEvent e) {
constraintsButton1.gridwidth = 2; constraintsButton1.gridheight = 1;
constraintsButton1.anchor = GridBagConstraints.CENTER;
constraintsButton1.insets= new Insets(8, 0, 8, 0);
- getContentPane().add(button, constraintsButton1);
+ getContentPane().add(close, constraintsButton1);
GridBagConstraints constraintsLogo1= new GridBagConstraints();
constraintsLogo1.gridx = 2; constraintsLogo1.gridy = 0;
View
24 junit/swingui/CounterPanel.java
@@ -1,9 +1,8 @@
package junit.swingui;
+import java.awt.GridLayout;
+
import javax.swing.*;
-import javax.swing.event.*;
-import javax.swing.border.*;
-import java.awt.*;
/**
* A panel with test run counters
@@ -12,23 +11,26 @@
private JTextField fNumberOfErrors;
private JTextField fNumberOfFailures;
private JTextField fNumberOfRuns;
+ private Icon fFailureIcon= TestRunner.getIconResource(getClass(), "icons/failure.gif");
+ private Icon fErrorIcon= TestRunner.getIconResource(getClass(), "icons/error.gif");
+
private int fTotal;
public CounterPanel() {
- super(new GridLayout(2, 3));
+ super(new GridLayout(1, 6));
+ fNumberOfErrors= createOutputField(8);
+ fNumberOfFailures= createOutputField(5);
+ fNumberOfRuns= createOutputField(5);
add(new JLabel("Runs:"));
- add(new JLabel("Errors:"));
- add(new JLabel("Failures: "));
- fNumberOfErrors= createOutputField();
- fNumberOfFailures= createOutputField();
- fNumberOfRuns= createOutputField();
add(fNumberOfRuns);
+ add(new JLabel("Errors:", fErrorIcon, SwingConstants.LEFT));
add(fNumberOfErrors);
+ add(new JLabel("Failures: ", fFailureIcon, SwingConstants.LEFT));
add(fNumberOfFailures);
}
- private JTextField createOutputField() {
- JTextField field= new JTextField("0", 10);
+ private JTextField createOutputField(int width) {
+ JTextField field= new JTextField("0", width);
field.setHorizontalAlignment(JTextField.LEFT);
field.setFont(StatusLine.BOLD_FONT);
field.setEditable(false);
View
85 junit/swingui/DefaultFailureDetailView.java
@@ -1,40 +1,95 @@
package junit.swingui;
-import java.awt.Component;
-import javax.swing.JTextArea;
-import java.io.*;
+import java.awt.*;
+import java.util.*;
+import javax.swing.*;
+import junit.framework.TestFailure;
import junit.runner.*;
-import junit.framework.*;
/**
* A view that shows a stack trace of a failure
*/
class DefaultFailureDetailView implements FailureDetailView {
- JTextArea fTextArea;
+ JList fList;
+
+ /**
+ * A ListModel representing the scanned failure stack trace.
+ */
+ static class StackTraceListModel extends AbstractListModel {
+ private Vector fLines= new Vector(20);
+
+ public Object getElementAt(int index) {
+ return fLines.elementAt(index);
+ }
+
+ public int getSize() {
+ return fLines.size();
+ }
+
+ public void setTrace(String trace) {
+ scan(trace);
+ fireContentsChanged(this, 0, fLines.size());
+ }
+
+ public void clear() {
+ fLines.removeAllElements();
+ fireContentsChanged(this, 0, fLines.size());
+ }
+
+ private void scan(String trace) {
+ fLines.removeAllElements();
+ StringTokenizer st= new StringTokenizer(trace, "\n\r", false);
+ while (st.hasMoreTokens())
+ fLines.add(st.nextToken());
+ }
+ }
+
+ /**
+ * Renderer for stack entries
+ */
+ static class StackEntryRenderer extends DefaultListCellRenderer {
+
+ public Component getListCellRendererComponent(
+ JList list, Object value, int modelIndex,
+ boolean isSelected, boolean cellHasFocus) {
+ String text= ((String)value).replace('\t', ' ');
+ Component c= super.getListCellRendererComponent(list, text, modelIndex, isSelected, cellHasFocus);
+ setText(text);
+ setToolTipText(text);
+ return c;
+ }
+ }
/**
* Returns the component used to present the trace
*/
public Component getComponent() {
- if (fTextArea == null) {
- fTextArea= new JTextArea();
- fTextArea.setRows(5);
- fTextArea.setTabSize(0);
- fTextArea.setEditable(false);
+ if (fList == null) {
+ fList= new JList(new StackTraceListModel());
+ fList.setFont(new Font("Dialog", Font.PLAIN, 12));
+ fList.setPrototypeCellValue("A Stack Trace Entry Line");
+ fList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ fList.setVisibleRowCount(5);
+ fList.setCellRenderer(new StackEntryRenderer());
}
- return fTextArea;
+ return fList;
}
/**
* Shows a TestFailure
*/
public void showFailure(TestFailure failure) {
- fTextArea.setText(BaseTestRunner.getFilteredTrace(failure.trace()));
- fTextArea.select(0, 0);
+ getModel().setTrace(BaseTestRunner.getFilteredTrace(failure.trace()));
}
-
+ /**
+ * Clears the output.
+ */
public void clear() {
- fTextArea.setText("");
+ getModel().clear();
+ }
+
+ private StackTraceListModel getModel() {
+ return (StackTraceListModel)fList.getModel();
}
}
View
26 junit/swingui/FailureRunView.java
@@ -1,12 +1,13 @@
package junit.swingui;
+import java.awt.*;
+
import javax.swing.*;
import javax.swing.event.*;
-import java.awt.Component;
-
import junit.framework.*;
import junit.runner.BaseTestRunner;
+
/**
* A view presenting the test failures as a list.
*/
@@ -35,6 +36,7 @@ public Component getListCellRendererComponent(
JList list, Object value, int modelIndex,
boolean isSelected, boolean cellHasFocus) {
+ Component c= super.getListCellRendererComponent(list, value, modelIndex, isSelected, cellHasFocus);
TestFailure failure= (TestFailure)value;
String text= failure.failedTest().toString();
String msg= failure.exceptionMessage();
@@ -43,12 +45,11 @@ public Component getListCellRendererComponent(
if (failure.isFailure()) {
if (fFailureIcon != null)
- setIcon(fFailureIcon);
+ setIcon(fFailureIcon);
} else {
- if (fErrorIcon != null)
- setIcon(fErrorIcon);
- }
- Component c= super.getListCellRendererComponent(list, text, modelIndex, isSelected, cellHasFocus);
+ if (fErrorIcon != null)
+ setIcon(fErrorIcon);
+ }
setText(text);
setToolTipText(text);
return c;
@@ -58,15 +59,16 @@ public Component getListCellRendererComponent(
public FailureRunView(TestRunContext context) {
fRunContext= context;
fFailureList= new JList(fRunContext.getFailures());
+ fFailureList.setFont(new Font("Dialog", Font.PLAIN, 12));
+
fFailureList.setPrototypeCellValue(
- new TestFailure(new TestCase("dummy") {
+ new TestFailure(new TestCase() {
protected void runTest() {}
},
new AssertionFailedError("message"))
);
fFailureList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
fFailureList.setCellRenderer(new FailureListCellRenderer());
- fFailureList.setToolTipText("Failure - grey X; Error - red X");
fFailureList.setVisibleRowCount(5);
fFailureList.addListSelectionListener(
@@ -93,9 +95,9 @@ public void activate() {
}
public void addTab(JTabbedPane pane) {
- JScrollPane sl= new JScrollPane(fFailureList, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
+ JScrollPane scrollPane= new JScrollPane(fFailureList, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
Icon errorIcon= TestRunner.getIconResource(getClass(), "icons/error.gif");
- pane.addTab("Failures", errorIcon, sl, "The list of failed tests");
+ pane.addTab("Failures", errorIcon, scrollPane, "The list of failed tests");
}
public void revealFailure(Test failure) {
@@ -112,5 +114,3 @@ protected void testSelected() {
fRunContext.handleTestSelected(getSelectedTest());
}
}
-
-
View
68 junit/swingui/ProgressBar.java
@@ -1,21 +1,18 @@
package junit.swingui;
-import javax.swing.*;
-import javax.swing.border.*;
-import java.awt.*;
+import java.awt.Color;
+
+import javax.swing.JProgressBar;
/**
- * A simple progress bar showing the green/red status
+ * A progress bar showing the green/red status
*/
-class ProgressBar extends JPanel {
+class ProgressBar extends JProgressBar {
boolean fError= false;
- int fTotal= 0;
- int fProgress= 0;
- int fProgressX= 0;
public ProgressBar() {
- super();
- setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
+ super();
+ setForeground(getStatusColor());
}
private Color getStatusColor() {
@@ -23,60 +20,23 @@ private Color getStatusColor() {
return Color.red;
return Color.green;
}
-
- public void paintBackground(Graphics g) {
- g.setColor(getBackground());
- g.fillRect(0,0,getWidth(),getHeight());
- }
-
- public void paintComponent(Graphics g) {
- paintBackground(g);
- paintStatus(g);
- }
-
- public void paintStatus(Graphics g) {
- g.setColor(getStatusColor());
- Rectangle r= new Rectangle(0, 0, fProgressX, getBounds().height);
- g.fillRect(1, 1, r.width-1, r.height-2);
- }
-
- private void paintStep(int startX, int endX) {
- repaint(startX, 1, endX-startX, getBounds().height-2);
- }
-
+
public void reset() {
- fProgressX= 1;
- fProgress= 0;
fError= false;
- repaint();
- }
-
- public int scale(int value) {
- if (fTotal > 0)
- return Math.max(1, value*(getBounds().width-1)/fTotal);
- return value;
- }
-
- public void setBounds(int x, int y, int w, int h) {
- super.setBounds(x, y, w, h);
- fProgressX= scale(fProgress);
+ setForeground(getStatusColor());
+ setValue(0);
}
public void start(int total) {
- fTotal= total;
+ setMaximum(total);
reset();
}
- public void step(boolean successful) {
- fProgress++;
- int x= fProgressX;
-
- fProgressX= scale(fProgress);
-
+ public void step(int value, boolean successful) {
+ setValue(value);
if (!fError && !successful) {
fError= true;
- x= 1;
+ setForeground(getStatusColor());
}
- paintStep(x, fProgressX);
}
}
View
3  junit/swingui/StatusLine.java
@@ -1,8 +1,9 @@
package junit.swingui;
import java.awt.*;
+
import javax.swing.*;
-import javax.swing.border.*;
+import javax.swing.border.BevelBorder;
/**
* A status line component.
View
5 junit/swingui/TestHierarchyRunView.java
@@ -1,10 +1,10 @@
package junit.swingui;
+import java.util.Vector;
+
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.tree.TreePath;
-import java.util.Vector;
-
import junit.framework.*;
/**
@@ -69,5 +69,4 @@ public void runFinished(Test suite, TestResult result) {
protected void testSelected() {
fTestContext.handleTestSelected(getSelectedTest());
}
-
}
View
3  junit/swingui/TestRunView.java
@@ -1,7 +1,6 @@
package junit.swingui;
-import javax.swing.*;
-
+import javax.swing.JTabbedPane;
import junit.framework.*;
/**
View
57 junit/swingui/TestRunner.java
@@ -1,20 +1,15 @@
package junit.swingui;
-import junit.framework.*;
-import junit.runner.*;
-
-import java.util.*;
-import java.lang.reflect.*;
-import java.text.NumberFormat;
-import java.net.URL;
+import java.awt.*;
+import java.awt.event.*;
import java.io.*;
+import java.net.URL;
+import java.util.*;
import javax.swing.*;
import javax.swing.event.*;
-import javax.swing.text.*;
-import java.awt.*;
-import java.awt.event.*;
-import java.awt.image.*;
+import junit.framework.*;
+import junit.runner.*;
/**
* A Swing based user interface to run tests.
@@ -26,6 +21,11 @@
* TestRunner takes as an optional argument the name of the testcase class to be run.
*/
public class TestRunner extends BaseTestRunner implements TestRunContext {
+ private static Font PLAIN_FONT= StatusLine.PLAIN_FONT;
+ private static Font BOLD_FONT= StatusLine.BOLD_FONT;
+ private static final int GAP= 4;
+ private static final int HISTORY_LENGTH= 5;
+
protected JFrame fFrame;
private Thread fRunner;
private TestResult fTestResult;
@@ -43,10 +43,6 @@
private JTabbedPane fTestViewTab;
private JCheckBox fUseLoadingRunner;
private Vector fTestRunViews= new Vector(); // view associated with tab in tabbed pane
- private static Font PLAIN_FONT= StatusLine.PLAIN_FONT;
- private static Font BOLD_FONT= StatusLine.BOLD_FONT;
- private static final int GAP= 4;
- private static final int HISTORY_LENGTH= 5;
private static final String TESTCOLLECTOR_KEY= "TestCollectorClass";
private static final String FAILUREDETAILVIEW_KEY= "FailureViewClass";
@@ -93,7 +89,7 @@ public void testEnded(String stringName) {
public void run() {
if (fTestResult != null) {
fCounterPanel.setRunValue(fTestResult.runCount());
- fProgressIndicator.step(fTestResult.wasSuccessful());
+ fProgressIndicator.step(fTestResult.runCount(), fTestResult.wasSuccessful());
}
}
}
@@ -307,7 +303,7 @@ public void actionPerformed(ActionEvent e) {
}
protected StatusLine createStatusLine() {
- return new StatusLine(420);
+ return new StatusLine(380);
}
protected JComboBox createSuiteCombo() {
@@ -408,21 +404,23 @@ protected JFrame createUI(String suiteName) {
addGrid(panel, fRun, 2, 1, 1, GridBagConstraints.HORIZONTAL, 0.0, GridBagConstraints.CENTER);
addGrid(panel, fUseLoadingRunner, 0, 2, 3, GridBagConstraints.NONE, 1.0, GridBagConstraints.WEST);
- addGrid(panel, new JSeparator(), 0, 3, 3, GridBagConstraints.HORIZONTAL, 1.0, GridBagConstraints.WEST);
+ //addGrid(panel, new JSeparator(), 0, 3, 3, GridBagConstraints.HORIZONTAL, 1.0, GridBagConstraints.WEST);
- addGrid(panel, fProgressIndicator, 0, 4, 2, GridBagConstraints.HORIZONTAL, 1.0, GridBagConstraints.WEST);
- addGrid(panel, fLogo, 2, 4, 1, GridBagConstraints.NONE, 0.0, GridBagConstraints.NORTH);
+ addGrid(panel, fProgressIndicator, 0, 3, 2, GridBagConstraints.HORIZONTAL, 1.0, GridBagConstraints.WEST);
+ addGrid(panel, fLogo, 2, 3, 1, GridBagConstraints.NONE, 0.0, GridBagConstraints.NORTH);
- addGrid(panel, fCounterPanel, 0, 5, 2, GridBagConstraints.NONE, 0.0, GridBagConstraints.CENTER);
+ addGrid(panel, fCounterPanel, 0, 4, 2, GridBagConstraints.NONE, 0.0, GridBagConstraints.WEST);
+ addGrid(panel, new JSeparator(), 0, 5, 2, GridBagConstraints.HORIZONTAL, 1.0, GridBagConstraints.WEST);
+ addGrid(panel, new JLabel("Results:"), 0, 6, 2, GridBagConstraints.HORIZONTAL, 1.0, GridBagConstraints.WEST);
JSplitPane splitter= new JSplitPane(JSplitPane.VERTICAL_SPLIT, fTestViewTab, tracePane);
- addGrid(panel, splitter, 0, 6, 2, GridBagConstraints.BOTH, 1.0, GridBagConstraints.WEST);
+ addGrid(panel, splitter, 0, 7, 2, GridBagConstraints.BOTH, 1.0, GridBagConstraints.WEST);
- addGrid(panel, failedPanel, 2, 6, 1, GridBagConstraints.HORIZONTAL, 0.0, GridBagConstraints.NORTH/*CENTER*/);
+ addGrid(panel, failedPanel, 2, 7, 1, GridBagConstraints.HORIZONTAL, 0.0, GridBagConstraints.NORTH/*CENTER*/);
- addGrid(panel, fStatusLine, 0, 8, 2, GridBagConstraints.HORIZONTAL, 1.0, GridBagConstraints.CENTER);
- addGrid(panel, fQuitButton, 2, 8, 1, GridBagConstraints.HORIZONTAL, 0.0, GridBagConstraints.CENTER);
+ addGrid(panel, fStatusLine, 0, 9, 2, GridBagConstraints.HORIZONTAL, 1.0, GridBagConstraints.CENTER);
+ addGrid(panel, fQuitButton, 2, 9, 1, GridBagConstraints.HORIZONTAL, 0.0, GridBagConstraints.CENTER);
frame.setContentPane(panel);
frame.pack();
@@ -550,12 +548,11 @@ private void rerunTest(Test test) {
return;
}
Test reloadedTest= null;
+ TestCase rerunTest= (TestCase)test;
+
try {
- Class reloadedTestClass= getLoader().reload(test.getClass());
- Class[] classArgs= { String.class };
- Constructor constructor= reloadedTestClass.getConstructor(classArgs);
- Object[] args= new Object[]{((TestCase)test).getName()};
- reloadedTest= (Test)constructor.newInstance(args);
+ Class reloadedTestClass= getLoader().reload(test.getClass());
+ reloadedTest= TestSuite.createTest(reloadedTestClass, rerunTest.getName());
} catch(Exception e) {
showInfo("Could not reload "+ test.toString());
return;
View
5 junit/swingui/TestSelector.java
@@ -1,12 +1,11 @@
package junit.swingui;
-import java.util.*;
import java.awt.*;
import java.awt.event.*;
+import java.util.*;
+
import javax.swing.*;
import javax.swing.event.*;
-
-import junit.framework.*;
import junit.runner.*;
/**
View
5 junit/swingui/TestSuitePanel.java
@@ -1,12 +1,11 @@
package junit.swingui;
-import java.util.Vector;
import java.awt.*;
+import java.util.Vector;
+
import javax.swing.*;
import javax.swing.tree.*;
-
import junit.framework.*;
-import junit.runner.*;
/**
* A Panel showing a test suite as a tree.
View
4 junit/swingui/TestTreeModel.java
@@ -1,10 +1,10 @@
package junit.swingui;
import java.util.*;
+
import javax.swing.event.*;
import javax.swing.tree.*;
-
-import junit.extensions.*;
+import junit.extensions.TestDecorator;
import junit.framework.*;
/**
View
3  junit/tests/WasRun.java
@@ -8,9 +8,6 @@
*/
public class WasRun extends TestCase {
public boolean fWasRun= false;
- public WasRun(String name) {
- super(name);
- }
protected void runTest() {
fWasRun= true;
}
View
16 junit/tests/extensions/ActiveTestTest.java
@@ -9,19 +9,11 @@
public class ActiveTestTest extends TestCase {
- public static class SuccessTest extends TestCase {
- public SuccessTest(String name) {
- super(name);
+ public static class SuccessTest extends TestCase {
+ public void runTest() {
}
-
- public void success() {
- }
- }
-
- public ActiveTestTest(String name) {
- super(name);
}
-
+
public void testActiveTest() {
Test test= createActiveTestSuite();
TestResult result= new TestResult();
@@ -61,7 +53,7 @@ public void testActiveRepeatedTest1() {
ActiveTestSuite createActiveTestSuite() {
ActiveTestSuite suite= new ActiveTestSuite();
for (int i= 0; i < 100; i++)
- suite.addTest(new SuccessTest("success"));
+ suite.addTest(new SuccessTest());
return suite;
}
View
3  junit/tests/extensions/ExceptionTestCaseTest.java
@@ -31,9 +31,6 @@ public void test() {
}
}
- public ExceptionTestCaseTest(String name) {
- super(name);
- }
public void testExceptionSubclass() {
ExceptionTestCase test= new ThrowExceptionTestCase("test", IndexOutOfBoundsException.class);
TestResult result= test.run();
View
9 junit/tests/extensions/ExtensionTest.java
@@ -9,7 +9,7 @@
*
*/
public class ExtensionTest extends TestCase {
- static class TornDown extends TestSetup {
+ static class TornDown extends TestSetup {
boolean fTornDown= false;
TornDown(Test test) {
@@ -19,9 +19,6 @@ protected void tearDown() {
fTornDown= true;
}
}
- public ExtensionTest(String name) {
- super(name);
- }
public void testRunningErrorInTestSetup() {
TestCase test= new TestCase("failure") {
public void runTest() {
@@ -61,7 +58,7 @@ public void runTest() {
assertEquals(1, result.errorCount());
}
public void testSetupErrorDontTearDown() {
- WasRun test= new WasRun("");
+ WasRun test= new WasRun();
TornDown wrapper= new TornDown(test) {
public void setUp() {
@@ -75,7 +72,7 @@ public void setUp() {
assertTrue(!wrapper.fTornDown);
}
public void testSetupErrorInTestSetup() {
- WasRun test= new WasRun("");
+ WasRun test= new WasRun();
TestSetup wrapper= new TestSetup(test) {
public void setUp() {
View
9 junit/tests/extensions/RepeatedTestTest.java
@@ -11,19 +11,16 @@
private TestSuite fSuite;
public static class SuccessTest extends TestCase {
- public SuccessTest(String name) {
- super(name);
- }
- public void success() {
+ public void runTest() {
}
}
public RepeatedTestTest(String name) {
super(name);
fSuite= new TestSuite();
- fSuite.addTest(new SuccessTest("success"));
- fSuite.addTest(new SuccessTest("success"));
+ fSuite.addTest(new SuccessTest());
+ fSuite.addTest(new SuccessTest());
}
public void testRepeatedOnce() {
View
6 junit/tests/framework/AssertTest.java
@@ -2,11 +2,7 @@
import junit.framework.*;
-public class AssertTest extends TestCase {
- public AssertTest(String name) {
- super(name);
- }
-
+public class AssertTest extends TestCase {
/**
* Test for the special Double.NaN value.
*/
View
6 junit/tests/framework/Failure.java
@@ -8,11 +8,7 @@
*
*/
public class Failure extends TestCase {
-
- public Failure(String name) {
- super(name);
- }
- public void test() {
+ public void runTest() {
fail();
}
}
View
5 junit/tests/framework/InheritedTestCase.java
@@ -3,10 +3,7 @@
/**
* Test class used in SuiteTest
*/
-public class InheritedTestCase extends OneTestCase {
- public InheritedTestCase(String name) {
- super(name);
- }
+public class InheritedTestCase extends OneTestCase {
public void test2() {
}
}
View
2  junit/tests/framework/NoTestCaseClass.java
@@ -6,8 +6,6 @@
import junit.framework.TestCase;
public class NoTestCaseClass extends Object {
- public NoTestCaseClass(String name) {
- }
public void testSuccess() {
}
}
View
3  junit/tests/framework/NoTestCases.java
@@ -6,9 +6,6 @@
import junit.framework.TestCase;
public class NoTestCases extends TestCase {
- public NoTestCases(String name) {
- super(name);
- }
public void noTestCase() {
}
}
View
3  junit/tests/framework/NotPublicTestCase.java
@@ -6,9 +6,6 @@
import junit.framework.TestCase;
public class NotPublicTestCase extends TestCase {
- public NotPublicTestCase(String name) {
- super(name);
- }
protected void testNotPublic() {
}
public void testPublic() {
View
3  junit/tests/framework/NotVoidTestCase.java
@@ -6,9 +6,6 @@
import junit.framework.TestCase;
public class NotVoidTestCase extends TestCase {
- public NotVoidTestCase(String name) {
- super(name);
- }
public int testNotVoid() {
return 1;
}
View
3  junit/tests/framework/OneTestCase.java
@@ -6,9 +6,6 @@
import junit.framework.TestCase;
public class OneTestCase extends TestCase {
- public OneTestCase(String name) {
- super(name);
- }
public void noTestCase() {
}
public void testCase() {
View
3  junit/tests/framework/OverrideTestCase.java
@@ -4,9 +4,6 @@
* Test class used in SuiteTest
*/
public class OverrideTestCase extends OneTestCase {
- public OverrideTestCase(String name) {
- super(name);
- }
public void testCase() {
}
}
View
6 junit/tests/framework/Success.java
@@ -9,9 +9,9 @@
*/
public class Success extends TestCase {
- public Success(String name) {
- super(name);
+ public void runTest() {
}
- public void test() {
+
+ public void testSuccess() {
}
}
View
2  junit/tests/framework/SuiteTest.java
@@ -13,7 +13,7 @@ public SuiteTest(String name) {
super(name);
}
protected void setUp() {
- fResult= new TestResult();
+ fResult= new TestResult();
}
public static Test suite() {
TestSuite suite= new TestSuite("Suite Tests");
View
16 junit/tests/framework/TestCaseTest.java
@@ -13,9 +13,6 @@
static class TornDown extends TestCase {
boolean fTornDown= false;
- TornDown(String name) {
- super(name);
- }
protected void tearDown() {
fTornDown= true;
}
@@ -24,9 +21,6 @@ protected void runTest() {
}
}
- public TestCaseTest(String name) {
- super(name);
- }
public void testCaseToString() {
// This test wins the award for twisted snake tail eating while
// writing self tests. And you thought those weird anonymous
@@ -42,7 +36,7 @@ protected void runTest() {
verifyError(error);
}
public void testRunAndTearDownFails() {
- TornDown fails= new TornDown("fails") {
+ TornDown fails= new TornDown() {
protected void tearDown() {
super.tearDown();
throw new Error();
@@ -81,7 +75,7 @@ protected void runTest() {
}
public void testTearDownAfterError() {
- TornDown fails= new TornDown("fails");
+ TornDown fails= new TornDown();
verifyError(fails);
assertTrue(fails.fTornDown);
}
@@ -97,7 +91,7 @@ protected void runTest() {
verifyError(fails);
}
public void testTearDownSetupFails() {
- TornDown fails= new TornDown("fails") {
+ TornDown fails= new TornDown() {
protected void setUp() {
throw new Error();
}
@@ -106,7 +100,7 @@ protected void setUp() {
assertTrue(!fails.fTornDown);
}
public void testWasRun() {
- WasRun test= new WasRun("");
+ WasRun test= new WasRun();
test.run();
assertTrue(test.fWasRun);
}
@@ -114,7 +108,7 @@ public void testExceptionRunningAndTearDown() {
// This test documents the current behavior. With 1.4, we should
// wrap the exception thrown while running with the exception thrown
// while tearing down
- Test t= new TornDown("") {
+ Test t= new TornDown() {
public void tearDown() {
throw new Error("tearDown");
}
View
9 junit/tests/framework/TestImplementorTest.java
@@ -28,17 +28,12 @@ public void protect() throws Throwable {
result.runProtected(this, p);
result.endTest(this);
}
-
- public String getDisplayName() {
- return "";
- }
}
private DoubleTestCase fTest;
- public TestImplementorTest(String name) {
- super(name);
- TestCase testCase= new TestCase("noop") {
+ public TestImplementorTest() {
+ TestCase testCase= new TestCase() {
public void runTest() {
}
};
View
4 junit/tests/framework/TestListenerTest.java
@@ -11,9 +11,7 @@
private int fEndCount;
private int fFailureCount;
private int fErrorCount;
- public TestListenerTest(String name) {
- super(name);
- }
+
public void addError(Test test, Throwable t) {
fErrorCount++;
}
View
4 junit/tests/runner/BaseTestRunnerTest.java
@@ -19,10 +19,6 @@ public void testFailed(int status, Test test, Throwable t) {
public void testStarted(String testName) {
}
}
-
- public BaseTestRunnerTest(String name) {
- super(name);
- }
public static class NonStatic {
public Test suite() {
View
7 junit/tests/runner/SimpleTestCollectorTest.java
@@ -4,13 +4,6 @@
import junit.runner.SimpleTestCollector;
public class SimpleTestCollectorTest extends TestCase {
-
- /**
- * Constructor for ClassPathTestCollectorTest
- */
- public SimpleTestCollectorTest(String name) {
- super(name);
- }
public void testMissingDirectory() {
SimpleTestCollector collector= new SimpleTestCollector();
View
4 junit/tests/runner/SorterTest.java
@@ -15,10 +15,6 @@ public void swap(Vector values, int left, int right) {
}
}
- public SorterTest(String name) {
- super(name);
- }
-
public void testSort() throws Exception {
Vector v= new Vector();
v.addElement("c");
View
4 junit/tests/runner/StackFilterTest.java
@@ -8,10 +8,6 @@
String fFiltered;
String fUnfiltered;
- public StackFilterTest(String name) {
- super(name);
- }
-
protected void setUp() {
StringWriter swin= new StringWriter();
PrintWriter pwin= new PrintWriter(swin);
View
3  junit/tests/runner/TestCaseClassLoaderTest.java
@@ -11,9 +11,6 @@
*/
public class TestCaseClassLoaderTest extends TestCase {
- public TestCaseClassLoaderTest(String name) {
- super(name);
- }
public void testClassLoading() throws Exception {
TestCaseClassLoader loader= new TestCaseClassLoader();
Class loadedClass= loader.loadClass("junit.tests.runner.ClassLoaderTest", true);
View
3  junit/tests/runner/TextRunnerTest.java
@@ -7,9 +7,6 @@
import java.io.IOException;
public class TextRunnerTest extends TestCase {
- public TextRunnerTest(String name) {
- super(name);
- }
public void testFailure() throws Exception {
execTest("junit.tests.framework.Failure", false);
View
2  stylesheet.css
@@ -1 +1 @@
-/* Javadoc style sheet */
+/* Javadoc style sheet */
Please sign in to comment.
Something went wrong with that request. Please try again.