Pārlūkot izejas kodu

Update junit, replace mockito

Not sure why mockito was moved out of the main lib
Remove UI runner hacks for now (don't work with JUnit >4.1)

Change-Id: I88bfaa42da1273681f1b8415f8e7f59184ad2399
Reviewed-on: http://gerrit.dmdirc.com/357
Reviewed-by: Gregory Holmes <greboid@dmdirc.com>
Tested-by: Gregory Holmes <greboid@dmdirc.com>
tags/0.6.3b1
Chris Smith 14 gadus atpakaļ
vecāks
revīzija
2855eebbe4

Binārs
lib/junit-4.1.jar Parādīt failu


Binārs
lib/junit-4.8.1.jar Parādīt failu


Binārs
lib/mockito-all-1.6.jar Parādīt failu


+ 10
- 5
nbproject/project.properties Parādīt failu

@@ -1,9 +1,10 @@
1
+file.reference.junit-4.8.1.jar=lib/junit-4.8.1.jar
2
+file.reference.mockito-all-1.6.jar=lib/mockito-all-1.6.jar
1 3
 jaxbwiz.endorsed.dirs="${netbeans.home}/../ide12/modules/ext/jaxb/api"
2 4
 project.license=dmdirc
3 5
 application.title=DMDirc
4 6
 application.vendor=chris
5 7
 build.generated.sources.dir=${build.dir}/generated-sources
6
-file.reference.junit-4.jar=lib/junit-4.1.jar
7 8
 
8 9
 doccheck.path=doccheck.jar
9 10
 doccheck.dir=reports/doccheck/
@@ -66,19 +67,23 @@ plugins.test.dir=modules/plugins/test
66 67
 # suckiness.
67 68
 # Without this parameter, everything will still compile, but netbeans won't
68 69
 # know about any files it isn't explicitly told about.
69
-javac.classpath=${private.classpath}:${plugins.libs.path}
70
+javac.classpath=\
71
+    ${private.classpath}:\
72
+    ${plugins.libs.path}
70 73
 javac.test.classpath=\
71 74
     ${javac.classpath}:\
72 75
     ${build.classes.dir}:\
73
-    ${file.reference.junit-4.jar}
76
+    ${file.reference.junit-4.8.1.jar}:\
77
+    ${file.reference.mockito-all-1.6.jar}
74 78
 run.classpath=\
75 79
     ${javac.classpath}:\
76 80
     ${build.classes.dir}
77 81
 run.test.classpath=\
78 82
     ${javac.test.classpath}:\
79 83
     ${build.test.classes.dir}:\
80
-    ${file.reference.junit-4.jar}
84
+    ${file.reference.junit-4.8.1.jar}:\
85
+    ${file.reference.mockito-all-1.6.jar}
81 86
 debug.classpath=\
82 87
     ${run.classpath}
83 88
 debug.test.classpath=\
84
-    ${run.test.classpath}
89
+    ${run.test.classpath}

+ 0
- 54
test/com/dmdirc/harness/ui/UIClassTestRunner.java Parādīt failu

@@ -1,54 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2010 Chris Smith, Shane Mc Cormack, Gregory Holmes
3
- *
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy
5
- * of this software and associated documentation files (the "Software"), to deal
6
- * in the Software without restriction, including without limitation the rights
7
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- * copies of the Software, and to permit persons to whom the Software is
9
- * furnished to do so, subject to the following conditions:
10
- *
11
- * The above copyright notice and this permission notice shall be included in
12
- * all copies or substantial portions of the Software.
13
- *
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- * SOFTWARE.
21
- */
22
-
23
-package com.dmdirc.harness.ui;
24
-
25
-import java.lang.reflect.InvocationTargetException;
26
-import java.lang.reflect.Method;
27
-import org.junit.BeforeClass;
28
-import org.junit.internal.runners.TestClassMethodsRunner;
29
-import org.junit.internal.runners.TestMethodRunner;
30
-import org.junit.runner.notification.RunNotifier;
31
-
32
-public class UIClassTestRunner extends TestClassMethodsRunner {
33
-
34
-    public UIClassTestRunner(Class<?> arg0) {
35
-        super(arg0);
36
-
37
-        for (Method method : arg0.getMethods()) {
38
-            if (method.getAnnotation(BeforeClass.class) != null) {
39
-                try {
40
-                    method.invoke(null);
41
-                } catch (InvocationTargetException e) {
42
-                    return;
43
-                } catch (Throwable e) {
44
-                    return;
45
-                }
46
-            }
47
-        }
48
-    }
49
-
50
-    protected TestMethodRunner createMethodRunner(Object test, Method method, RunNotifier notifier) {
51
-        return new UIMethodTestRunner(test, method, notifier, methodDescription(method));
52
-    }
53
-
54
-}

+ 0
- 83
test/com/dmdirc/harness/ui/UIMethodTestRunner.java Parādīt failu

@@ -1,83 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2010 Chris Smith, Shane Mc Cormack, Gregory Holmes
3
- *
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy
5
- * of this software and associated documentation files (the "Software"), to deal
6
- * in the Software without restriction, including without limitation the rights
7
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- * copies of the Software, and to permit persons to whom the Software is
9
- * furnished to do so, subject to the following conditions:
10
- *
11
- * The above copyright notice and this permission notice shall be included in
12
- * all copies or substantial portions of the Software.
13
- *
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- * SOFTWARE.
21
- */
22
-
23
-package com.dmdirc.harness.ui;
24
-
25
-import java.lang.reflect.InvocationTargetException;
26
-import java.lang.reflect.Method;
27
-
28
-import org.fest.swing.exception.ActionFailedException;
29
-import org.junit.internal.runners.TestMethodRunner;
30
-import org.junit.runner.Description;
31
-import org.junit.runner.notification.RunNotifier;
32
-
33
-public class UIMethodTestRunner extends TestMethodRunner {
34
-
35
-    private final Object test;
36
-
37
-    public UIMethodTestRunner(Object test, Method method,
38
-                                    RunNotifier notifier,
39
-                                    Description description) {
40
-        super(test, method, notifier, description);
41
-        this.test = test;
42
-    }
43
-
44
-    @Override
45
-    protected void runUnprotected() {
46
-        try {
47
-            ((UITestIface) test).setUp();
48
-
49
-            boolean retry;
50
-            int retries = 5;
51
-
52
-            do {
53
-                retry = false;
54
-
55
-                try {
56
-                    executeMethodBody();
57
-                } catch (ActionFailedException e) {
58
-                    if (--retries > 0) {
59
-                        retry = true;
60
-                        ((UITestIface) test).tearDown();
61
-                        ((UITestIface) test).setUp();
62
-                    } else {
63
-                        addFailure(e);
64
-                    }
65
-                } catch (InvocationTargetException e) {
66
-                    addFailure(e.getCause());
67
-                } catch (Throwable e) {
68
-                    addFailure(e);
69
-                }
70
-            } while (retry);
71
-
72
-            ((UITestIface) test).tearDown();
73
-        } catch (Throwable ex) {
74
-            addFailure(ex);
75
-        }
76
-    }
77
-
78
-    @Override
79
-    public void runProtected() {
80
-        runUnprotected();
81
-    }
82
-
83
-}

+ 0
- 30
test/com/dmdirc/harness/ui/UITestIface.java Parādīt failu

@@ -1,30 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2010 Chris Smith, Shane Mc Cormack, Gregory Holmes
3
- *
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy
5
- * of this software and associated documentation files (the "Software"), to deal
6
- * in the Software without restriction, including without limitation the rights
7
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- * copies of the Software, and to permit persons to whom the Software is
9
- * furnished to do so, subject to the following conditions:
10
- *
11
- * The above copyright notice and this permission notice shall be included in
12
- * all copies or substantial portions of the Software.
13
- *
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- * SOFTWARE.
21
- */
22
-
23
-package com.dmdirc.harness.ui;
24
-
25
-public interface UITestIface {
26
-
27
-    void setUp() throws Exception;
28
-    void tearDown() throws Exception;
29
-
30
-}

Notiek ielāde…
Atcelt
Saglabāt