Skip to content

Commit 5b6a144

Browse files
committed
Add @test annotations to tests
1 parent ea09033 commit 5b6a144

36 files changed

+332
-190
lines changed

src/test/com/jacob/com/ActiveXComponentFactoryTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.jacob.com;
22

3+
import org.junit.Test;
4+
35
import com.jacob.activeX.ActiveXComponent;
46
import com.jacob.test.BaseTestCase;
57

@@ -18,6 +20,7 @@ public class ActiveXComponentFactoryTest extends BaseTestCase {
1820
* too. Unfortunately, it requires that the runner of the test verify via
1921
* the "Windows Task Manager"
2022
*/
23+
@Test
2124
public void testMultipleInstances() {
2225
ComThread.InitMTA();
2326
String mApplicationId = "Word.Application";
@@ -40,6 +43,7 @@ public void testMultipleInstances() {
4043
* single running instance. It requires that a user physically watch the
4144
* "Windows Task Manager" to verify only one copy of MS Word is executing
4245
*/
46+
@Test
4347
public void testOnlyOneInstance() {
4448
ComThread.InitMTA();
4549
String mApplicationId = "Word.Application";
@@ -59,6 +63,7 @@ public void testOnlyOneInstance() {
5963
/**
6064
* Test that verifies function of the ActiveXComponentFactory
6165
*/
66+
@Test
6267
public void testActiveXComponentFactory() {
6368
ComThread.InitSTA(true);
6469
try {

src/test/com/jacob/com/DispatchNullProgramId.java renamed to src/test/com/jacob/com/DispatchNullProgramIdTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.jacob.com;
22

3+
import org.junit.Test;
4+
35
import com.jacob.test.BaseTestCase;
46

57
/**
@@ -11,11 +13,12 @@
1113
* Eclipse). Look in the docs area at the Jacob usage document for command line
1214
* options.
1315
*/
14-
public class DispatchNullProgramId extends BaseTestCase {
16+
public class DispatchNullProgramIdTest extends BaseTestCase {
1517

1618
/**
1719
* Verify that dispatch constructors are protected from null program ids.
1820
*/
21+
@Test
1922
public void testNullProgramId() {
2023
try {
2124
String nullParam = null;

src/test/com/jacob/com/DispatchTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.jacob.com;
22

3+
import org.junit.Test;
4+
35
import com.jacob.activeX.ActiveXComponent;
46
import com.jacob.test.BaseTestCase;
57

@@ -15,6 +17,7 @@ public class DispatchTest extends BaseTestCase {
1517
/**
1618
* Verify this detects word's exit
1719
*/
20+
@Test
1821
public void testDispatchHasExited() {
1922
String pid = "Word.Application";
2023
ActiveXComponent axc = new ActiveXComponent(pid);

src/test/com/jacob/com/DispatchValidDispatchTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.jacob.com;
22

3+
import org.junit.Test;
4+
35
import com.jacob.test.BaseTestCase;
46

57
/**
@@ -15,6 +17,7 @@ public class DispatchValidDispatchTest extends BaseTestCase {
1517
* force an IllegalArgumentException to verify the utility method throws
1618
* correctly.
1719
*/
20+
@Test
1821
public void testThrowIllegalArgumentException() {
1922
try {
2023
Dispatch.call(null, 0);
@@ -29,6 +32,7 @@ public void testThrowIllegalArgumentException() {
2932
* force an IllegalStateException to verify the utility method throws
3033
* correctly.
3134
*/
35+
@Test
3236
public void testThrowIllegalStateException() {
3337
try {
3438
Dispatch foo = new Dispatch();

src/test/com/jacob/com/JacobDeadlockTest.java

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.jacob.com;
22

3+
import org.junit.Test;
4+
35
import com.jacob.test.BaseTestCase;
46

57
/**
@@ -17,9 +19,9 @@
1719
* <p>
1820
* This test will fail with debug logging turned on because of the amount of
1921
* time it takes to write the debug output.
20-
*
22+
*
2123
* @author jsamarziya
22-
*
24+
*
2325
*/
2426
public class JacobDeadlockTest extends BaseTestCase {
2527
private static final long TIMEOUT = 5000l;
@@ -32,11 +34,11 @@ public static class TestThread extends Thread {
3234

3335
/**
3436
* constructor for ThestThread
35-
*
37+
*
3638
* @param id
3739
* @param initCOM
3840
* @param writeOutput
39-
*
41+
*
4042
*/
4143
public TestThread(int id, boolean initCOM, boolean writeOutput) {
4244
this.id = id;
@@ -71,9 +73,10 @@ private void log(String message) {
7173
/**
7274
* This test shows that if ComThread.Init() is called explicitly, no problem
7375
* occurs.
74-
*
76+
*
7577
* @throws InterruptedException
7678
*/
79+
@Test
7780
public void testShowNoProblemIfCOMIsInitialized()
7881
throws InterruptedException {
7982
runTest(2, true, false);
@@ -83,21 +86,23 @@ public void testShowNoProblemIfCOMIsInitialized()
8386
/**
8487
* This test shows that if only one thread is creating COM objects, no
8588
* problem occurs.
86-
*
89+
*
8790
* @throws InterruptedException
8891
*/
92+
@Test
8993
public void testShowNoProblemIfSingleThreaded() throws InterruptedException {
9094
runTest(1, false, false);
9195
runTest(1, true, false);
9296
}
9397

9498
/**
9599
* Runs the test with two threads, which don't initialize the COM thread.
96-
*
100+
*
97101
* This test will always fail.
98-
*
102+
*
99103
* @throws InterruptedException
100104
*/
105+
@Test
101106
public void testShowDeadlockProblem() throws InterruptedException {
102107
runTest(2, false, true);
103108
}

src/test/com/jacob/com/JacobObjectTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.jacob.com;
22

3+
import org.junit.Test;
4+
35
import com.jacob.test.BaseTestCase;
46

57
/**
@@ -14,6 +16,7 @@ public class JacobObjectTest extends BaseTestCase {
1416
/**
1517
* verify the build version and date functions work correctly
1618
*/
19+
@Test
1720
public void testBuildVersion() {
1821
System.out.println("build version is " + JacobReleaseInfo.getBuildVersion());
1922
System.out.println("build date is " + JacobReleaseInfo.getBuildDate());

src/test/com/jacob/com/LibraryLoaderTest.java

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,21 @@
88
* be compiled and added to the classpath. You will need to refresh the release
99
* directory so that eclipse knows about jacob.jar. Otherwise you will get a
1010
* "jar not found" dialog.
11-
*
11+
*
1212
* <p>
1313
* May need to run with some command line options (including from inside
1414
* Eclipse). Look in the docs area at the Jacob usage document for command line
1515
* options.
16-
*
16+
*
1717
* @author clay_shooter
18-
*
18+
*
1919
*/
2020
public class LibraryLoaderTest {
2121

2222
/**
2323
* verify the architecture switches work
2424
*/
25+
@Test
2526
public void testArchitectureVersions() {
2627
System.out.println("running on 32Bit? VM"
2728
+ LibraryLoader.shouldLoad32Bit());
@@ -72,16 +73,18 @@ public void testDLLNameContainsProcessorAndVersion() {
7273
// we build the package and run the unit tests on X86
7374
Assert.assertTrue(LibraryLoader.getPreferredDLLName()
7475
+ "should have contained "
75-
+ LibraryLoader.DLL_NAME_MODIFIER_32_BIT, LibraryLoader
76-
.getPreferredDLLName().contains(
77-
LibraryLoader.DLL_NAME_MODIFIER_32_BIT));
76+
+ LibraryLoader.DLL_NAME_MODIFIER_32_BIT,
77+
LibraryLoader
78+
.getPreferredDLLName().contains(
79+
LibraryLoader.DLL_NAME_MODIFIER_32_BIT));
7880
} else {
7981
// we build the package and run the unit tests on X86
8082
Assert.assertTrue(LibraryLoader.getPreferredDLLName()
8183
+ "should have contained "
82-
+ LibraryLoader.DLL_NAME_MODIFIER_64_BIT, LibraryLoader
83-
.getPreferredDLLName().contains(
84-
LibraryLoader.DLL_NAME_MODIFIER_64_BIT));
84+
+ LibraryLoader.DLL_NAME_MODIFIER_64_BIT,
85+
LibraryLoader
86+
.getPreferredDLLName().contains(
87+
LibraryLoader.DLL_NAME_MODIFIER_64_BIT));
8588
}
8689
}
8790
}

src/test/com/jacob/com/ROT2Test.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
package com.jacob.com;
22

3+
import org.junit.Test;
4+
35
import com.jacob.test.BaseTestCase;
46

57
/**
68
* This test class exists to test the WeakRefernce implementation .
7-
*
9+
*
810
* It is not useful if there isn't one at this time
9-
*
11+
*
1012
* <p>
1113
* May need to run with some command line options (including from inside
1214
* Eclipse). Look in the docs area at the Jacob usage document for command line
@@ -17,6 +19,7 @@ public class ROT2Test extends BaseTestCase {
1719
/**
1820
* runs a multi-threaded test
1921
*/
22+
@Test
2023
public void testDoesNotBlowUp() {
2124
ROT2TestThread threads[] = new ROT2TestThread[4];
2225
for (int i = 0; i < threads.length; i++) {
@@ -39,7 +42,7 @@ public class ROT2TestThread extends Thread {
3942
/**
4043
* @param arg0
4144
* @param iStartCount
42-
* the initial number of threads
45+
* the initial number of threads
4346
*/
4447
public ROT2TestThread(String arg0, int iStartCount) {
4548
super(arg0);
@@ -51,7 +54,7 @@ public ROT2TestThread(String arg0, int iStartCount) {
5154
* A semi-complex series of steps to put the ROT under stress. 1)
5255
* discard half the objects we've created 2) if size is greater than 1
5356
* but not a even number, add 1 new object 3) stop when size is 1.
54-
*
57+
*
5558
* @see java.lang.Runnable#run()
5659
*/
5760
public void run() {
@@ -112,7 +115,7 @@ public void run() {
112115
/**
113116
* Another test would be to override this to always return the same
114117
* name. That would really screw the ROT!
115-
*
118+
*
116119
* @see java.lang.Object#toString()
117120
*/
118121
public String toString() {

src/test/com/jacob/com/ROT3Test.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
package com.jacob.com;
22

3+
import org.junit.Test;
4+
35
import com.jacob.test.BaseTestCase;
46

57
/**
68
* This tries to exercise ROT's garbage collection This is named this way
79
* because the build.xml ignores files ending in Test when building the binary
810
* zip file
9-
*
11+
*
1012
* This will eventually be changed to a unit test.
11-
*
13+
*
1214
* <p>
1315
* May need to run with some command line options (including from inside
1416
* Eclipse). Look in the docs area at the Jacob usage document for command line
@@ -19,6 +21,7 @@ public class ROT3Test extends BaseTestCase {
1921
/**
2022
* runs a multi-threaded test
2123
*/
24+
@Test
2225
public void testROTVersion3() {
2326
ROT3TestThread threads[] = new ROT3TestThread[4];
2427
for (int i = 0; i < threads.length; i++) {
@@ -41,7 +44,7 @@ public class ROT3TestThread extends Thread {
4144
/**
4245
* @param arg0
4346
* @param iStartCount
44-
* the number of initial threads
47+
* the number of initial threads
4548
*/
4649
public ROT3TestThread(String arg0, int iStartCount) {
4750
super(arg0);
@@ -53,7 +56,7 @@ public ROT3TestThread(String arg0, int iStartCount) {
5356
* A semi-complex series of steps to put the ROT under stress. 1)
5457
* discard half the objects we've created 2) if size is greater than 1
5558
* but not a even number, add 1 new object 3) stop when size is 1.
56-
*
59+
*
5760
* @see java.lang.Runnable#run()
5861
*/
5962
@SuppressWarnings("deprecation")
@@ -131,7 +134,7 @@ public void run() {
131134
/**
132135
* Another test would be to overide this to always return the same name.
133136
* That would really screw the ROT!
134-
*
137+
*
135138
* @see java.lang.Object#toString()
136139
*/
137140
public String toString() {

src/test/com/jacob/com/ROTTest.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
package com.jacob.com;
22

3+
import org.junit.Test;
4+
35
import com.jacob.test.BaseTestCase;
46

57
/**
68
* This tries to exercise ROT's garbage collection
7-
*
9+
*
810
* This will eventually be changed to a unit test.
911
* <p>
1012
* May need to run with some command line options (including from inside
@@ -18,6 +20,7 @@ public class ROTTest extends BaseTestCase {
1820
* value of false means instances of the class are not put in the ROT Any o
1921
* ther value means they are
2022
*/
23+
@Test
2124
public void testDontFillROTSystemProperty() {
2225
debug("testDontFillROTSystemProperty: started");
2326
// Make sure the class is loaded before running any of the tests
@@ -53,8 +56,9 @@ public void testDontFillROTSystemProperty() {
5356

5457
/**
5558
* Needs documentation. This test looks broken
56-
*
59+
*
5760
*/
61+
@Test
5862
public void testGCBehavior() {
5963
int sizeBeforeBuild = 0;
6064
int sizeAfterBuild = 0;

0 commit comments

Comments
 (0)