diff --git a/src/test/com/jacob/com/ActiveXComponentFactoryTest.java b/src/test/com/jacob/com/ActiveXComponentFactoryTest.java index 71f4c26..edc0157 100644 --- a/src/test/com/jacob/com/ActiveXComponentFactoryTest.java +++ b/src/test/com/jacob/com/ActiveXComponentFactoryTest.java @@ -1,5 +1,7 @@ package com.jacob.com; +import org.junit.Test; + import com.jacob.activeX.ActiveXComponent; import com.jacob.test.BaseTestCase; @@ -18,6 +20,7 @@ public class ActiveXComponentFactoryTest extends BaseTestCase { * too. Unfortunately, it requires that the runner of the test verify via * the "Windows Task Manager" */ + @Test public void testMultipleInstances() { ComThread.InitMTA(); String mApplicationId = "Word.Application"; @@ -40,6 +43,7 @@ public void testMultipleInstances() { * single running instance. It requires that a user physically watch the * "Windows Task Manager" to verify only one copy of MS Word is executing */ + @Test public void testOnlyOneInstance() { ComThread.InitMTA(); String mApplicationId = "Word.Application"; @@ -59,6 +63,7 @@ public void testOnlyOneInstance() { /** * Test that verifies function of the ActiveXComponentFactory */ + @Test public void testActiveXComponentFactory() { ComThread.InitSTA(true); try { diff --git a/src/test/com/jacob/com/DispatchNullProgramId.java b/src/test/com/jacob/com/DispatchNullProgramIdTest.java similarity index 92% rename from src/test/com/jacob/com/DispatchNullProgramId.java rename to src/test/com/jacob/com/DispatchNullProgramIdTest.java index 5146562..4531ad6 100644 --- a/src/test/com/jacob/com/DispatchNullProgramId.java +++ b/src/test/com/jacob/com/DispatchNullProgramIdTest.java @@ -1,5 +1,7 @@ package com.jacob.com; +import org.junit.Test; + import com.jacob.test.BaseTestCase; /** @@ -11,11 +13,12 @@ * Eclipse). Look in the docs area at the Jacob usage document for command line * options. */ -public class DispatchNullProgramId extends BaseTestCase { +public class DispatchNullProgramIdTest extends BaseTestCase { /** * Verify that dispatch constructors are protected from null program ids. */ + @Test public void testNullProgramId() { try { String nullParam = null; diff --git a/src/test/com/jacob/com/DispatchTest.java b/src/test/com/jacob/com/DispatchTest.java index 5cbde73..914f04a 100644 --- a/src/test/com/jacob/com/DispatchTest.java +++ b/src/test/com/jacob/com/DispatchTest.java @@ -1,5 +1,7 @@ package com.jacob.com; +import org.junit.Test; + import com.jacob.activeX.ActiveXComponent; import com.jacob.test.BaseTestCase; @@ -15,6 +17,7 @@ public class DispatchTest extends BaseTestCase { /** * Verify this detects word's exit */ + @Test public void testDispatchHasExited() { String pid = "Word.Application"; ActiveXComponent axc = new ActiveXComponent(pid); diff --git a/src/test/com/jacob/com/DispatchValidDispatchTest.java b/src/test/com/jacob/com/DispatchValidDispatchTest.java index 54bf635..12fec15 100644 --- a/src/test/com/jacob/com/DispatchValidDispatchTest.java +++ b/src/test/com/jacob/com/DispatchValidDispatchTest.java @@ -1,5 +1,7 @@ package com.jacob.com; +import org.junit.Test; + import com.jacob.test.BaseTestCase; /** @@ -15,6 +17,7 @@ public class DispatchValidDispatchTest extends BaseTestCase { * force an IllegalArgumentException to verify the utility method throws * correctly. */ + @Test public void testThrowIllegalArgumentException() { try { Dispatch.call(null, 0); @@ -29,6 +32,7 @@ public void testThrowIllegalArgumentException() { * force an IllegalStateException to verify the utility method throws * correctly. */ + @Test public void testThrowIllegalStateException() { try { Dispatch foo = new Dispatch(); diff --git a/src/test/com/jacob/com/JacobDeadlockTest.java b/src/test/com/jacob/com/JacobDeadlockTest.java index 1639fed..39e3c0e 100644 --- a/src/test/com/jacob/com/JacobDeadlockTest.java +++ b/src/test/com/jacob/com/JacobDeadlockTest.java @@ -1,5 +1,7 @@ package com.jacob.com; +import org.junit.Test; + import com.jacob.test.BaseTestCase; /** @@ -17,9 +19,9 @@ *
* This test will fail with debug logging turned on because of the amount of * time it takes to write the debug output. - * + * * @author jsamarziya - * + * */ public class JacobDeadlockTest extends BaseTestCase { private static final long TIMEOUT = 5000l; @@ -32,11 +34,11 @@ public static class TestThread extends Thread { /** * constructor for ThestThread - * + * * @param id * @param initCOM * @param writeOutput - * + * */ public TestThread(int id, boolean initCOM, boolean writeOutput) { this.id = id; @@ -71,9 +73,10 @@ private void log(String message) { /** * This test shows that if ComThread.Init() is called explicitly, no problem * occurs. - * + * * @throws InterruptedException */ + @Test public void testShowNoProblemIfCOMIsInitialized() throws InterruptedException { runTest(2, true, false); @@ -83,9 +86,10 @@ public void testShowNoProblemIfCOMIsInitialized() /** * This test shows that if only one thread is creating COM objects, no * problem occurs. - * + * * @throws InterruptedException */ + @Test public void testShowNoProblemIfSingleThreaded() throws InterruptedException { runTest(1, false, false); runTest(1, true, false); @@ -93,11 +97,12 @@ public void testShowNoProblemIfSingleThreaded() throws InterruptedException { /** * Runs the test with two threads, which don't initialize the COM thread. - * + * * This test will always fail. - * + * * @throws InterruptedException */ + @Test public void testShowDeadlockProblem() throws InterruptedException { runTest(2, false, true); } diff --git a/src/test/com/jacob/com/JacobObjectTest.java b/src/test/com/jacob/com/JacobObjectTest.java index 47da8a7..86e4ddb 100644 --- a/src/test/com/jacob/com/JacobObjectTest.java +++ b/src/test/com/jacob/com/JacobObjectTest.java @@ -1,5 +1,7 @@ package com.jacob.com; +import org.junit.Test; + import com.jacob.test.BaseTestCase; /** @@ -14,6 +16,7 @@ public class JacobObjectTest extends BaseTestCase { /** * verify the build version and date functions work correctly */ + @Test public void testBuildVersion() { System.out.println("build version is " + JacobReleaseInfo.getBuildVersion()); System.out.println("build date is " + JacobReleaseInfo.getBuildDate()); diff --git a/src/test/com/jacob/com/LibraryLoaderTest.java b/src/test/com/jacob/com/LibraryLoaderTest.java index 3da467e..4a41eb0 100644 --- a/src/test/com/jacob/com/LibraryLoaderTest.java +++ b/src/test/com/jacob/com/LibraryLoaderTest.java @@ -8,20 +8,21 @@ * be compiled and added to the classpath. You will need to refresh the release * directory so that eclipse knows about jacob.jar. Otherwise you will get a * "jar not found" dialog. - * + * *
* May need to run with some command line options (including from inside * Eclipse). Look in the docs area at the Jacob usage document for command line * options. - * + * * @author clay_shooter - * + * */ public class LibraryLoaderTest { /** * verify the architecture switches work */ + @Test public void testArchitectureVersions() { System.out.println("running on 32Bit? VM" + LibraryLoader.shouldLoad32Bit()); @@ -72,16 +73,18 @@ public void testDLLNameContainsProcessorAndVersion() { // we build the package and run the unit tests on X86 Assert.assertTrue(LibraryLoader.getPreferredDLLName() + "should have contained " - + LibraryLoader.DLL_NAME_MODIFIER_32_BIT, LibraryLoader - .getPreferredDLLName().contains( - LibraryLoader.DLL_NAME_MODIFIER_32_BIT)); + + LibraryLoader.DLL_NAME_MODIFIER_32_BIT, + LibraryLoader + .getPreferredDLLName().contains( + LibraryLoader.DLL_NAME_MODIFIER_32_BIT)); } else { // we build the package and run the unit tests on X86 Assert.assertTrue(LibraryLoader.getPreferredDLLName() + "should have contained " - + LibraryLoader.DLL_NAME_MODIFIER_64_BIT, LibraryLoader - .getPreferredDLLName().contains( - LibraryLoader.DLL_NAME_MODIFIER_64_BIT)); + + LibraryLoader.DLL_NAME_MODIFIER_64_BIT, + LibraryLoader + .getPreferredDLLName().contains( + LibraryLoader.DLL_NAME_MODIFIER_64_BIT)); } } } diff --git a/src/test/com/jacob/com/ROT2Test.java b/src/test/com/jacob/com/ROT2Test.java index ff30cf1..43188af 100644 --- a/src/test/com/jacob/com/ROT2Test.java +++ b/src/test/com/jacob/com/ROT2Test.java @@ -1,12 +1,14 @@ package com.jacob.com; +import org.junit.Test; + import com.jacob.test.BaseTestCase; /** * This test class exists to test the WeakRefernce implementation . - * + * * It is not useful if there isn't one at this time - * + * *
* May need to run with some command line options (including from inside * Eclipse). Look in the docs area at the Jacob usage document for command line @@ -17,6 +19,7 @@ public class ROT2Test extends BaseTestCase { /** * runs a multi-threaded test */ + @Test public void testDoesNotBlowUp() { ROT2TestThread threads[] = new ROT2TestThread[4]; for (int i = 0; i < threads.length; i++) { @@ -39,7 +42,7 @@ public class ROT2TestThread extends Thread { /** * @param arg0 * @param iStartCount - * the initial number of threads + * the initial number of threads */ public ROT2TestThread(String arg0, int iStartCount) { super(arg0); @@ -51,7 +54,7 @@ public ROT2TestThread(String arg0, int iStartCount) { * A semi-complex series of steps to put the ROT under stress. 1) * discard half the objects we've created 2) if size is greater than 1 * but not a even number, add 1 new object 3) stop when size is 1. - * + * * @see java.lang.Runnable#run() */ public void run() { @@ -112,7 +115,7 @@ public void run() { /** * Another test would be to override this to always return the same * name. That would really screw the ROT! - * + * * @see java.lang.Object#toString() */ public String toString() { diff --git a/src/test/com/jacob/com/ROT3Test.java b/src/test/com/jacob/com/ROT3Test.java index 798c420..87f4fca 100644 --- a/src/test/com/jacob/com/ROT3Test.java +++ b/src/test/com/jacob/com/ROT3Test.java @@ -1,14 +1,16 @@ package com.jacob.com; +import org.junit.Test; + import com.jacob.test.BaseTestCase; /** * This tries to exercise ROT's garbage collection This is named this way * because the build.xml ignores files ending in Test when building the binary * zip file - * + * * This will eventually be changed to a unit test. - * + * *
* May need to run with some command line options (including from inside * Eclipse). Look in the docs area at the Jacob usage document for command line @@ -19,6 +21,7 @@ public class ROT3Test extends BaseTestCase { /** * runs a multi-threaded test */ + @Test public void testROTVersion3() { ROT3TestThread threads[] = new ROT3TestThread[4]; for (int i = 0; i < threads.length; i++) { @@ -41,7 +44,7 @@ public class ROT3TestThread extends Thread { /** * @param arg0 * @param iStartCount - * the number of initial threads + * the number of initial threads */ public ROT3TestThread(String arg0, int iStartCount) { super(arg0); @@ -53,7 +56,7 @@ public ROT3TestThread(String arg0, int iStartCount) { * A semi-complex series of steps to put the ROT under stress. 1) * discard half the objects we've created 2) if size is greater than 1 * but not a even number, add 1 new object 3) stop when size is 1. - * + * * @see java.lang.Runnable#run() */ @SuppressWarnings("deprecation") @@ -131,7 +134,7 @@ public void run() { /** * Another test would be to overide this to always return the same name. * That would really screw the ROT! - * + * * @see java.lang.Object#toString() */ public String toString() { diff --git a/src/test/com/jacob/com/ROTTest.java b/src/test/com/jacob/com/ROTTest.java index 38b032b..89e28a0 100644 --- a/src/test/com/jacob/com/ROTTest.java +++ b/src/test/com/jacob/com/ROTTest.java @@ -1,10 +1,12 @@ package com.jacob.com; +import org.junit.Test; + import com.jacob.test.BaseTestCase; /** * This tries to exercise ROT's garbage collection - * + * * This will eventually be changed to a unit test. *
* May need to run with some command line options (including from inside @@ -18,6 +20,7 @@ public class ROTTest extends BaseTestCase { * value of false means instances of the class are not put in the ROT Any o * ther value means they are */ + @Test public void testDontFillROTSystemProperty() { debug("testDontFillROTSystemProperty: started"); // Make sure the class is loaded before running any of the tests @@ -53,8 +56,9 @@ public void testDontFillROTSystemProperty() { /** * Needs documentation. This test looks broken - * + * */ + @Test public void testGCBehavior() { int sizeBeforeBuild = 0; int sizeAfterBuild = 0; diff --git a/src/test/com/jacob/com/VariantDateTest.java b/src/test/com/jacob/com/VariantDateTest.java index 892422f..8bd585d 100644 --- a/src/test/com/jacob/com/VariantDateTest.java +++ b/src/test/com/jacob/com/VariantDateTest.java @@ -2,6 +2,8 @@ import java.util.Date; +import org.junit.Test; + import com.jacob.test.BaseTestCase; /** @@ -16,6 +18,7 @@ public class VariantDateTest extends BaseTestCase { /** * verify the conversion of Variants into java dates */ + @Test public void testVariantDate() { Date now = new Date(); Variant holder = new Variant(); @@ -33,6 +36,7 @@ public void testVariantDate() { * verify that the Variant constructor accepts Java dates and converts them * correctly */ + @Test public void testVariantDateToJavaObject() { Date now = new Date(); Variant holder = new Variant(now); diff --git a/src/test/com/jacob/com/VariantTest.java b/src/test/com/jacob/com/VariantTest.java index 6dcedec..f19c7f8 100644 --- a/src/test/com/jacob/com/VariantTest.java +++ b/src/test/com/jacob/com/VariantTest.java @@ -4,11 +4,13 @@ import java.math.BigInteger; import java.util.Date; +import org.junit.Test; + import com.jacob.test.BaseTestCase; /** * runs through some of the get and set methods on Variant - * + * *
* May need to run with some command line options (including from inside * Eclipse). Look in the docs area at the Jacob usage document for command line @@ -22,8 +24,9 @@ public class VariantTest extends BaseTestCase { *
* It compares the toJavaObject() for a byref against the toJavaObject() for
* the regular.
- *
+ *
*/
+ @Test
public void testByRefToJavaObject() {
Variant v = null;
Variant vByRef = null;
@@ -91,6 +94,7 @@ public void testByRefToJavaObject() {
/**
* try and test VT_I8. This should only work on 64 bit machines
*/
+ @Test
public void testLong() {
Variant v = null;
Variant vByRef = null;
@@ -112,6 +116,7 @@ public void testLong() {
/**
* do some testing around currencies
*/
+ @Test
public void testCurrencyHandling() {
Variant v = null;
Variant vByRef = null;
@@ -145,8 +150,9 @@ public void testCurrencyHandling() {
/**
* 4/2007 bug report toObject on dispatch tries to call getDispatchRef
* instead of getDispatch so toString() on dispatch blows up.
- *
+ *
*/
+ @Test
public void testDispatchToJavaObject() {
Variant v2 = new Variant();
v2.putNothing();
@@ -156,8 +162,9 @@ public void testDispatchToJavaObject() {
/**
* see what happens when we conver to by ref
- *
+ *
*/
+ @Test
public void testSomeChangeVT() {
Variant v;
// the code shows e shouldn't need to use a returned Variant but the
@@ -193,8 +200,9 @@ public void testSomeChangeVT() {
/**
* make sure variant with no backing store works.
- *
+ *
*/
+ @Test
public void testUninitializedVariant() {
Variant v;
// Variants created without parameters are auto set to VariantEmpty
@@ -224,9 +232,10 @@ public void testUninitializedVariant() {
}
/**
- *
+ *
* verify the toString() method does not do type conversion
*/
+ @Test
public void testToStringDoesNotConvert() {
Variant v;
v = new Variant(true);
@@ -256,6 +265,7 @@ public void testToStringDoesNotConvert() {
/**
* Exercise ToString special cases
*/
+ @Test
public void testToStringEmptyValues() {
Variant v;
// create an empty variant
@@ -283,6 +293,7 @@ public void testToStringEmptyValues() {
* Verify that booleans can be released. Part of the suite that checks all
* types.
*/
+ @Test
public void testSafeReleaseBoolean() {
Variant v;
v = new Variant(true);
@@ -316,8 +327,9 @@ public void testSafeReleaseBoolean() {
/**
* verify the constant values aren't released with safeRelease
- *
+ *
*/
+ @Test
public void testSafeReleaseConstant() {
// System.out.println("Using Static constant Variant - should never
// throw access violation");
@@ -349,8 +361,9 @@ public void testSafeReleaseConstant() {
* this used to try and and create an access violation but that didn't work
* and now the methods on the Variant are smarter about working after a
* release
- *
+ *
*/
+ @Test
public void testSafeReleaseString() {
String mTestString = "Guitar Hero";
Variant v = new Variant(mTestString);
@@ -369,8 +382,9 @@ public void testSafeReleaseString() {
/**
* verifies objectIsAConstant works as expected
- *
+ *
*/
+ @Test
public void testObjectIsAConstant() {
Variant v = new Variant("d");
if (!v.objectIsAConstant(Variant.VT_FALSE)) {
@@ -396,8 +410,9 @@ public void testObjectIsAConstant() {
/**
* tests put and get methods looking for obvious defects
- *
+ *
*/
+ @Test
public void testPutsAndGets() {
Variant v = new Variant();
@@ -481,6 +496,7 @@ public void testPutsAndGets() {
/**
* verify decimal works right
*/
+ @Test
public void testDecimalConversion() {
Variant v = new Variant();
v.changeType(Variant.VariantDecimal);
@@ -505,8 +521,9 @@ public void testDecimalConversion() {
* for(BigDecimal i in 79228162514264337593543950330.0 ..
* 79228162514264337593543950341.0) { com.jacob.com.Variant dv = new
* com.jacob.com.Variant(i, false) println i + " : " + dv.getDecimal() }
- *
+ *
*/
+ @Test
public void testLargeDecimals() {
// the largest decimal number, not in hex is
// 7922816251426433759354395033.0
@@ -568,12 +585,14 @@ public void testLargeDecimals() {
+ modifiedDecimal.scale());
System.out.println("integer piece after rounding without scale is "
+ VariantUtilities.roundToMSDecimal(modifiedDecimal)
- .unscaledValue().toString(16) + " scale=: "
+ .unscaledValue().toString(16)
+ + " scale=: "
+ modifiedDecimal.scale());
System.out.println("integer piece after rounding with scale 30 is "
+ VariantUtilities
.roundToMSDecimal(modifiedDecimal.setScale(30))
- .unscaledValue().toString(16) + " scale=: "
+ .unscaledValue().toString(16)
+ + " scale=: "
+ modifiedDecimal.scale());
try {
testVariant.putDecimal(VariantUtilities
@@ -592,12 +611,14 @@ public void testLargeDecimals() {
+ modifiedDecimal.scale());
System.out.println("integer piece after rounding without scale is "
+ VariantUtilities.roundToMSDecimal(modifiedDecimal)
- .unscaledValue().toString(16) + " scale=: "
+ .unscaledValue().toString(16)
+ + " scale=: "
+ modifiedDecimal.scale());
System.out.println("integer piece after rounding with scale 30 is "
+ VariantUtilities
.roundToMSDecimal(modifiedDecimal.setScale(30))
- .unscaledValue().toString(16) + " scale=: "
+ .unscaledValue().toString(16)
+ + " scale=: "
+ modifiedDecimal.scale());
testVariant.putDecimal(VariantUtilities
.roundToMSDecimal(modifiedDecimal.setScale(30)));
@@ -608,8 +629,9 @@ public void testLargeDecimals() {
* Spin up a lot of threads and have them all create variants 3/2007 there
* have been several reports in multi-threaded servers that show init()
* failing
- *
+ *
*/
+ @Test
public void testManyThreadedInit() {
VariantInitTestThread threads[] = new VariantInitTestThread[75];
@@ -643,7 +665,7 @@ public void testManyThreadedInit() {
/**
* a class to create variants in separate threads
- *
+ *
*/
class VariantInitTestThread extends Thread {
private boolean isComplete = false;
@@ -652,9 +674,9 @@ class VariantInitTestThread extends Thread {
/**
* @param newThreadName
- * the name for the thread
+ * the name for the thread
* @param iStartCount
- * number of threads to start with
+ * number of threads to start with
*/
public VariantInitTestThread(String newThreadName, int iStartCount) {
super(newThreadName);
@@ -664,7 +686,7 @@ public VariantInitTestThread(String newThreadName, int iStartCount) {
/**
* getter so master can see if thread is done
- *
+ *
* @return state of complete flag
*/
public boolean isComplete() {
@@ -673,7 +695,7 @@ public boolean isComplete() {
/**
* Blow out a bunch of Variants
- *
+ *
* @see java.lang.Runnable#run()
*/
@Override
diff --git a/src/test/com/jacob/com/VariantUtilitiesTest.java b/src/test/com/jacob/com/VariantUtilitiesTest.java
index 423ca25..8d999b3 100644
--- a/src/test/com/jacob/com/VariantUtilitiesTest.java
+++ b/src/test/com/jacob/com/VariantUtilitiesTest.java
@@ -3,17 +3,20 @@
import java.util.Arrays;
import java.util.Date;
+import org.junit.Test;
+
import com.jacob.test.BaseTestCase;
/**
* This class should test some of the converter capabilities
- *
+ *
*/
public class VariantUtilitiesTest extends BaseTestCase {
/**
* verifies our unpacking stuff
*/
+ @Test
public void testObjectsToVariants() {
Object testArray[] = new Object[] { Integer.valueOf(1),
Integer.valueOf(2) };
@@ -30,6 +33,7 @@ public void testObjectsToVariants() {
/**
* test nested arrays
*/
+ @Test
public void testObjectsToVariantNestedArray() {
Object testArray[] = new Object[] { Integer.valueOf(1),
Integer.valueOf(2) };
@@ -44,6 +48,7 @@ public void testObjectsToVariantNestedArray() {
* verify that dispatch can convert from object to variant and that the
* variant holds the right value
*/
+ @Test
public void testConverters() {
Date testDate = new Date();
Variant fromDate = VariantUtilities.objectToVariant(testDate);
@@ -61,6 +66,7 @@ public void testConverters() {
}
+ @Test
public void testPrimitiveByteArray() {
byte[] arr = new byte[] { 1, 2, 3 };
@@ -78,6 +84,7 @@ public void testPrimitiveByteArray() {
assertTrue(Arrays.equals(bytes, arr));
}
+ @Test
public void testPrimitiveIntArray() {
int[] arr = new int[] { 1000, 2000, 3 };
@@ -95,6 +102,7 @@ public void testPrimitiveIntArray() {
assertTrue(Arrays.equals(ints, arr));
}
+ @Test
public void testPrimitiveDoubleArray() {
double[] arr = new double[] { 1000, 2000, 3 };
@@ -112,6 +120,7 @@ public void testPrimitiveDoubleArray() {
assertTrue(Arrays.equals(doubles, arr));
}
+ @Test
public void testPrimitiveLongArray() {
long[] arr = new long[] { 0xcafebabecafebabeL, 42, 0xbabecafebabeL };
diff --git a/src/test/com/jacob/test/BaseTestCase.java b/src/test/com/jacob/test/BaseTestCase.java
index acbd062..24b1d4e 100644
--- a/src/test/com/jacob/test/BaseTestCase.java
+++ b/src/test/com/jacob/test/BaseTestCase.java
@@ -2,6 +2,9 @@
import java.net.URL;
+import org.junit.Before;
+import org.junit.Test;
+
import junit.framework.TestCase;
import com.jacob.com.JacobObject;
@@ -23,7 +26,7 @@
*/
public class BaseTestCase extends TestCase {
- @SuppressWarnings("unused")
+ @Before
protected void setUp() {
// verify we have run with the dll in the lib path
try {
@@ -40,6 +43,7 @@ protected void setUp() {
/**
* this test exists just to test the setup.
*/
+ @Test
public void testSetup() {
JacobObject foo = new JacobObject();
assertNotNull(foo);
diff --git a/src/test/com/jacob/test/errors/UnicodeErrorTest.java b/src/test/com/jacob/test/errors/UnicodeErrorTest.java
index b4a4f1c..1bfb15a 100644
--- a/src/test/com/jacob/test/errors/UnicodeErrorTest.java
+++ b/src/test/com/jacob/test/errors/UnicodeErrorTest.java
@@ -1,15 +1,18 @@
package com.jacob.test.errors;
import com.jacob.test.BaseTestCase;
+
+import org.junit.Test;
+
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.ComException;
/**
* This test verifies patch SF 1794811 . It shows how unicode filenames throw
* exceptions in 1.13M4 and earlier.
- *
+ *
* @author justme84
- *
+ *
*/
public class UnicodeErrorTest extends BaseTestCase {
@@ -17,6 +20,7 @@ public class UnicodeErrorTest extends BaseTestCase {
* verifies that messages can now have unicode in them like when the file
* names have unicode characters
*/
+ @Test
public void testUnicodeCharactersInErrorMessage() {
ActiveXComponent application = new ActiveXComponent("Word.Application");
ActiveXComponent documents = application
@@ -27,8 +31,9 @@ public void testUnicodeCharactersInErrorMessage() {
fail("Should have thrown an exception");
} catch (ComException e) {
assertTrue("Error message should contain file name with unicode "
- + "characters in it. " + e.getMessage(), e.getMessage()
- .indexOf(fileName) > 0);
+ + "characters in it. " + e.getMessage(),
+ e.getMessage()
+ .indexOf(fileName) > 0);
}
}
}
\ No newline at end of file
diff --git a/src/test/com/jacob/test/events/ExcelEventTest.java b/src/test/com/jacob/test/events/ExcelEventTest.java
index e84c51d..3742182 100644
--- a/src/test/com/jacob/test/events/ExcelEventTest.java
+++ b/src/test/com/jacob/test/events/ExcelEventTest.java
@@ -1,5 +1,7 @@
package com.jacob.test.events;
+import org.junit.Test;
+
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.ComException;
import com.jacob.com.ComThread;
@@ -26,6 +28,7 @@ public class ExcelEventTest extends BaseTestCase {
*
* @param args
*/
+ @Test
public void testExcelWithInvocationProxy() {
ComThread.InitSTA();
// we are going to listen to events on Application.
diff --git a/src/test/com/jacob/test/events/IETest.java b/src/test/com/jacob/test/events/IETest.java
index 845de86..5ac1c01 100644
--- a/src/test/com/jacob/test/events/IETest.java
+++ b/src/test/com/jacob/test/events/IETest.java
@@ -1,5 +1,7 @@
package com.jacob.test.events;
+import org.junit.Test;
+
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.ComThread;
import com.jacob.com.Dispatch;
@@ -9,7 +11,7 @@
/**
* This test runs fine against jdk 1.4 and 1.5
- *
+ *
* This demonstrates the new event handling code in jacob 1.7 This example will
* open up IE and print out some of the events it listens to as it navigates to
* web sites. contributed by Niels Olof Bouvin mailto:n.o.bouvin@daimi.au.dk and
@@ -32,6 +34,7 @@ public class IETest extends BaseTestCase {
/**
* runs the IE test and feeds it commands
*/
+ @Test
public void testRunIECleanly() {
runTheTest(true, testUrls);
}
@@ -39,13 +42,14 @@ public void testRunIECleanly() {
/**
* runs the IE test and feeds it commands
*/
+ @Test
public void testRunIETerminateWithoutWait() {
runTheTest(false, testUrls);
}
/**
* The actual work of running the test.
- *
+ *
* @param waitForQuit
* @param urls
*/
@@ -99,11 +103,11 @@ class IETestThread extends Thread {
/**
* constructor for the test thread
- *
+ *
* @param beNeat
- * should we wait until quit received
+ * should we wait until quit received
* @param urls
- * the web pages we will navigate to
+ * the web pages we will navigate to
*/
public IETestThread(boolean beNeat, String urls[]) {
super();
@@ -184,9 +188,9 @@ public void run() {
public class IEEvents {
/**
* Internet explorer event this proxy can receive
- *
+ *
* @param args
- * the COM Variant objects that this event passes in.
+ * the COM Variant objects that this event passes in.
*/
public void BeforeNavigate2(Variant[] args) {
System.out.println("IEEvents Received ("
@@ -196,9 +200,9 @@ public void BeforeNavigate2(Variant[] args) {
/**
* Internet explorer event this proxy can receive
- *
+ *
* @param args
- * the COM Variant objects that this event passes in.
+ * the COM Variant objects that this event passes in.
*/
public void CommandStateChange(Variant[] args) {
System.out.println("IEEvents Received ("
@@ -208,9 +212,9 @@ public void CommandStateChange(Variant[] args) {
/**
* Internet explorer event this proxy can receive
- *
+ *
* @param args
- * the COM Variant objects that this event passes in.
+ * the COM Variant objects that this event passes in.
*/
public void DocumentComplete(Variant[] args) {
System.out.println("IEEvents Received ("
@@ -220,9 +224,9 @@ public void DocumentComplete(Variant[] args) {
/**
* Internet explorer event this proxy can receive
- *
+ *
* @param args
- * the COM Variant objects that this event passes in.
+ * the COM Variant objects that this event passes in.
*/
public void DownloadBegin(Variant[] args) {
System.out.println("IEEvents Received ("
@@ -232,9 +236,9 @@ public void DownloadBegin(Variant[] args) {
/**
* Internet explorer event this proxy can receive
- *
+ *
* @param args
- * the COM Variant objects that this event passes in.
+ * the COM Variant objects that this event passes in.
*/
public void DownloadComplete(Variant[] args) {
System.out.println("IEEvents Received ("
@@ -244,9 +248,9 @@ public void DownloadComplete(Variant[] args) {
/**
* Internet explorer event this proxy can receive
- *
+ *
* @param args
- * the COM Variant objects that this event passes in.
+ * the COM Variant objects that this event passes in.
*/
public void NavigateError(Variant[] args) {
System.out.println("IEEvents Received ("
@@ -256,9 +260,9 @@ public void NavigateError(Variant[] args) {
/**
* Internet explorer event this proxy can receive
- *
+ *
* @param args
- * the COM Variant objects that this event passes in.
+ * the COM Variant objects that this event passes in.
*/
public void NavigateComplete2(Variant[] args) {
System.out.println("IEEvents Received ("
@@ -268,9 +272,9 @@ public void NavigateComplete2(Variant[] args) {
/**
* Internet explorer event this proxy can receive
- *
+ *
* @param args
- * the COM Variant objects that this event passes in.
+ * the COM Variant objects that this event passes in.
*/
public void NewWindow2(Variant[] args) {
System.out.println("IEEvents Received ("
@@ -280,9 +284,9 @@ public void NewWindow2(Variant[] args) {
/**
* Internet explorer event this proxy can receive
- *
+ *
* @param args
- * the COM Variant objects that this event passes in.
+ * the COM Variant objects that this event passes in.
*/
public void OnFullScreen(Variant[] args) {
System.out.println("IEEvents Received ("
@@ -292,9 +296,9 @@ public void OnFullScreen(Variant[] args) {
/**
* Internet explorer event this proxy can receive
- *
+ *
* @param args
- * the COM Variant objects that this event passes in.
+ * the COM Variant objects that this event passes in.
*/
public void OnMenuBar(Variant[] args) {
System.out.println("IEEvents Received ("
@@ -304,9 +308,9 @@ public void OnMenuBar(Variant[] args) {
/**
* Internet explorer event this proxy can receive
- *
+ *
* @param args
- * the COM Variant objects that this event passes in.
+ * the COM Variant objects that this event passes in.
*/
public void OnQuit(Variant[] args) {
System.out.println("IEEvents Received ("
@@ -317,9 +321,9 @@ public void OnQuit(Variant[] args) {
/**
* Internet explorer event this proxy can receive
- *
+ *
* @param args
- * the COM Variant objects that this event passes in.
+ * the COM Variant objects that this event passes in.
*/
public void OnStatusBar(Variant[] args) {
System.out.println("IEEvents Received ("
@@ -329,9 +333,9 @@ public void OnStatusBar(Variant[] args) {
/**
* Internet explorer event this proxy can receive
- *
+ *
* @param args
- * the COM Variant objects that this event passes in.
+ * the COM Variant objects that this event passes in.
*/
public void OnTheaterMode(Variant[] args) {
System.out.println("IEEvents Received ("
@@ -341,9 +345,9 @@ public void OnTheaterMode(Variant[] args) {
/**
* Internet explorer event this proxy can receive
- *
+ *
* @param args
- * the COM Variant objects that this event passes in.
+ * the COM Variant objects that this event passes in.
*/
public void OnToolBar(Variant[] args) {
System.out.println("IEEvents Received ("
@@ -353,9 +357,9 @@ public void OnToolBar(Variant[] args) {
/**
* Internet explorer event this proxy can receive
- *
+ *
* @param args
- * the COM Variant objects that this event passes in.
+ * the COM Variant objects that this event passes in.
*/
public void OnVisible(Variant[] args) {
System.out.println("IEEvents Received ("
@@ -365,9 +369,9 @@ public void OnVisible(Variant[] args) {
/**
* Internet explorer event this proxy can receive
- *
+ *
* @param args
- * the COM Variant objects that this event passes in.
+ * the COM Variant objects that this event passes in.
*/
public void ProgressChange(Variant[] args) {
System.out.println("IEEvents Received ("
@@ -377,9 +381,9 @@ public void ProgressChange(Variant[] args) {
/**
* Internet explorer event this proxy can receive
- *
+ *
* @param args
- * the COM Variant objects that this event passes in.
+ * the COM Variant objects that this event passes in.
*/
public void PropertyChange(Variant[] args) {
System.out.println("IEEvents Received ("
@@ -389,9 +393,9 @@ public void PropertyChange(Variant[] args) {
/**
* Internet explorer event this proxy can receive
- *
+ *
* @param args
- * the COM Variant objects that this event passes in.
+ * the COM Variant objects that this event passes in.
*/
public void SetSecureLockIcon(Variant[] args) {
System.out.println("IEEvents Received ("
@@ -401,9 +405,9 @@ public void SetSecureLockIcon(Variant[] args) {
/**
* Internet explorer event this proxy can receive
- *
+ *
* @param args
- * the COM Variant objects that this event passes in.
+ * the COM Variant objects that this event passes in.
*/
public void StatusTextChange(Variant[] args) {
System.out.println("IEEvents Received ("
@@ -413,9 +417,9 @@ public void StatusTextChange(Variant[] args) {
/**
* Internet explorer event this proxy can receive
- *
+ *
* @param args
- * the COM Variant objects that this event passes in.
+ * the COM Variant objects that this event passes in.
*/
public void TitleChange(Variant[] args) {
System.out.println("IEEvents Received ("
@@ -425,9 +429,9 @@ public void TitleChange(Variant[] args) {
/**
* Internet explorer event this proxy can receive
- *
+ *
* @param args
- * the COM Variant objects that this event passes in.
+ * the COM Variant objects that this event passes in.
*/
public void WindowClosing(Variant[] args) {
System.out.println("IEEvents Received ("
diff --git a/src/test/com/jacob/test/events/IETestActiveXProxy.java b/src/test/com/jacob/test/events/IETestActiveXProxy.java
index 9c59188..a21b4ff 100644
--- a/src/test/com/jacob/test/events/IETestActiveXProxy.java
+++ b/src/test/com/jacob/test/events/IETestActiveXProxy.java
@@ -1,5 +1,7 @@
package com.jacob.test.events;
+import org.junit.Test;
+
import com.jacob.activeX.ActiveXComponent;
import com.jacob.activeX.ActiveXDispatchEvents;
import com.jacob.com.ComThread;
@@ -9,7 +11,7 @@
/**
* This test runs fine against jdk 1.4 and 1.5
- *
+ *
* This demonstrates the new event handling code in jacob 1.7 This example will
* open up IE and print out some of the events it listens to as it havigates to
* web sites. contributed by Niels Olof Bouvin mailto:n.o.bouvin@daimi.au.dk and
@@ -18,7 +20,7 @@
* May need to run with some command line options (including from inside
* Eclipse). Look in the docs area at the Jacob usage document for command line
* options.
- *
+ *
* @TODO: THIS TEST HANGS under windows 10 on whatever version it is for 2020/09
*/
@@ -27,6 +29,7 @@ public class IETestActiveXProxy extends BaseTestCase {
/**
* the main test method that builds up the connection and runs the test
*/
+ @Test
public void testIEActiveProxyCallback() {
// this line starts the pump but it runs fine without it
ComThread.startMainSTA();
diff --git a/src/test/com/jacob/test/events/WordEventTest.java b/src/test/com/jacob/test/events/WordEventTest.java
index bc81b73..f7c5073 100644
--- a/src/test/com/jacob/test/events/WordEventTest.java
+++ b/src/test/com/jacob/test/events/WordEventTest.java
@@ -1,5 +1,7 @@
package com.jacob.test.events;
+import org.junit.Test;
+
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.ComException;
import com.jacob.com.DispatchEvents;
@@ -22,9 +24,10 @@ public class WordEventTest extends BaseTestCase {
/**
* load up word, register for events and make stuff happen
- *
+ *
* @param args
*/
+ @Test
public void testCaptureWordEvents() {
String pid = "Word.Application";
String typeLibLocation = null;
diff --git a/src/test/com/jacob/test/excel/ControllerTest.java b/src/test/com/jacob/test/excel/ControllerTest.java
index efd6d4b..10d1061 100644
--- a/src/test/com/jacob/test/excel/ControllerTest.java
+++ b/src/test/com/jacob/test/excel/ControllerTest.java
@@ -5,6 +5,9 @@
import java.util.List;
import java.util.StringTokenizer;
+import org.junit.Before;
+import org.junit.Test;
+
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.ComThread;
import com.jacob.com.Dispatch;
@@ -14,27 +17,28 @@
/**
* this test verifies that you can call toString() on a Variant extracted from
* Excel that contains a 2 dimensional array of doubles. 1.14M5 and earlier blew
- * up on this because two objects pointed at the same windows memory space SF 1840487
+ * up on this because two objects pointed at the same windows memory space SF
+ * 1840487
*/
public class ControllerTest extends BaseTestCase {
private Controller controller;
+ @Before
protected void setUp() {
controller = new Controller();
}
+ @Test
public void testGetColumnA() {
- List
- * May need to run with some command line options (including from inside Eclipse).
+ * May need to run with some command line options (including from inside Eclipse).
* Look in the docs area at the Jacob usage document for command line options.
*/
import com.jacob.activeX.ActiveXComponent;
@@ -15,13 +17,14 @@
import com.jacob.test.BaseTestCase;
/**
- *
+ *
* power point test program posted to sourceforge to demonstrate memory problem.
* The submitter stated they had the problem on windows 2000 with office 2000 I
* have been unable to duplicate on windows XP with office 2003. I am adding
* this to the tree just in case we need to come back to it.
*
- * This test was modified for office 2007 to synchronize communication with Excel.
+ * This test was modified for office 2007 to synchronize communication with
+ * Excel.
* Office 2003 didn't require this.
*
* This relies on BaseTestCase to provide the root path to the file under test
@@ -36,9 +39,10 @@ public class PowerpointTest extends BaseTestCase {
/**
* main program that lets us run this as a test
- *
+ *
* @param args
*/
+ @Test
public void testPowerpoint() {
ComThread.InitMTA();
@@ -98,7 +102,7 @@ public class PowerpointTestThread extends Thread {
/**
* thread constructor
- *
+ *
* @param threadID
* @param comPowerpoint
*/
@@ -124,17 +128,17 @@ public void run() {
// multi-threaded requests than office 2007
// office 2003 could handle 5 threads @ 50 iterations
// office 2007 can only handle 1 thread at a time
- synchronized(comPowerpoint){
- Dispatch comPresentations = Dispatch.get(comPowerpoint,
- "Presentations").toDispatch();
- Dispatch comPresentation = Dispatch.call(
- comPresentations,
- "Open",
- getWindowsFilePathToPackageResource("test"
- + threadID + ".ppt", this.getClass()),
- new Integer(0), new Integer(0), new Integer(0))
- .toDispatch();
- Dispatch.call(comPresentation, "Close");
+ synchronized (comPowerpoint) {
+ Dispatch comPresentations = Dispatch.get(comPowerpoint,
+ "Presentations").toDispatch();
+ Dispatch comPresentation = Dispatch.call(
+ comPresentations,
+ "Open",
+ getWindowsFilePathToPackageResource("test"
+ + threadID + ".ppt", this.getClass()),
+ new Integer(0), new Integer(0), new Integer(0))
+ .toDispatch();
+ Dispatch.call(comPresentation, "Close");
}
}
} catch (ComFailException cfe) {
diff --git a/src/test/com/jacob/test/safearray/SafeArrayBasicTest.java b/src/test/com/jacob/test/safearray/SafeArrayBasicTest.java
index 96e2106..329adb2 100644
Binary files a/src/test/com/jacob/test/safearray/SafeArrayBasicTest.java and b/src/test/com/jacob/test/safearray/SafeArrayBasicTest.java differ
diff --git a/src/test/com/jacob/test/safearray/SafeArrayContents.java b/src/test/com/jacob/test/safearray/SafeArrayContents.java
index 1e9cc0a..b76c5a0 100644
--- a/src/test/com/jacob/test/safearray/SafeArrayContents.java
+++ b/src/test/com/jacob/test/safearray/SafeArrayContents.java
@@ -1,5 +1,7 @@
package com.jacob.test.safearray;
+import org.junit.Test;
+
import com.jacob.com.ComFailException;
import com.jacob.com.SafeArray;
import com.jacob.com.Variant;
@@ -7,7 +9,7 @@
/**
* A safe array contents test (old test)
- *
+ *
*
* May need to run with some command line options (including from inside
* Eclipse). Look in the docs area at the Jacob usage document for command line
@@ -87,6 +89,7 @@ public static void printArray(char a[]) {
System.out.println("]");
}
+ @Test
public void testSafeArrayContents() {
// int
System.out.println("Int");
diff --git a/src/test/com/jacob/test/safearray/SafeArrayDispatchTest.java b/src/test/com/jacob/test/safearray/SafeArrayDispatchTest.java
index 43796f8..f1681cc 100644
--- a/src/test/com/jacob/test/safearray/SafeArrayDispatchTest.java
+++ b/src/test/com/jacob/test/safearray/SafeArrayDispatchTest.java
@@ -1,5 +1,7 @@
package com.jacob.test.safearray;
+import org.junit.Test;
+
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.ComException;
import com.jacob.com.Dispatch;
@@ -11,6 +13,7 @@
* Test class to verify dispatch with SafeArray
*/
public class SafeArrayDispatchTest extends BaseTestCase {
+ @Test
public void testDispatchWithSafeArray() {
try {
String scriptCommand = "1+(2*4)-3";
diff --git a/src/test/com/jacob/test/safearray/SafeArrayLeak.java b/src/test/com/jacob/test/safearray/SafeArrayLeakTest.java
similarity index 97%
rename from src/test/com/jacob/test/safearray/SafeArrayLeak.java
rename to src/test/com/jacob/test/safearray/SafeArrayLeakTest.java
index f0405bc..f98093a 100644
--- a/src/test/com/jacob/test/safearray/SafeArrayLeak.java
+++ b/src/test/com/jacob/test/safearray/SafeArrayLeakTest.java
@@ -1,5 +1,7 @@
package com.jacob.test.safearray;
+import org.junit.Test;
+
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.ComThread;
import com.jacob.com.Dispatch;
@@ -19,13 +21,14 @@
* cycle. Running the same program with setString(r,c,String) does not show the
* same symptoms
*/
-public class SafeArrayLeak extends BaseTestCase {
+public class SafeArrayLeakTest extends BaseTestCase {
/**
* ----------------------------------------------------------------------------------------------------------------------------
- *
+ *
* ----------------------------------------------------------------------------------------------------------------------------
*/
+ @Test
public void testLeakWithSetString() {
ActiveXComponent xl = null;
diff --git a/src/test/com/jacob/test/safearray/SafeArrayReleaseTest.java b/src/test/com/jacob/test/safearray/SafeArrayReleaseTest.java
index 1ea6de3..4d3245f 100644
--- a/src/test/com/jacob/test/safearray/SafeArrayReleaseTest.java
+++ b/src/test/com/jacob/test/safearray/SafeArrayReleaseTest.java
@@ -1,5 +1,7 @@
package com.jacob.test.safearray;
+import org.junit.Test;
+
import com.jacob.com.ComThread;
import com.jacob.com.SafeArray;
import com.jacob.com.Variant;
@@ -14,38 +16,38 @@
* SF 1085370 In my understatnding, an instance of SafeArray java class has a
* value of a pointer to VARIANT structure that contains a pointer to a
* SAFEARRAY strucuture.
- *
+ *
* On the other hand, we can create a Variant object from the SafeArray object
* like this: SafeArray sa = ...; Variant val = new Variant(sa); the val object
* has a pointer to another VARIANT structure that contains a pointer to the
* same SAFEARRAY structure.
- *
+ *
* In this case, the val object has a pointer to another VARIANT that contains a
* pointer to the same SAFEARRAY like this:
- *
+ *
* +-----------+ |SafeArray | +------------+ | m_pV--->VARIANT(a) |
* +-----------+ | VT_ARRAY| +---------+ | parray---->SAFEARRAY| +------------+
* +^--------+ | +-----------+ | |Variant | +------------+ | |
* m_pVariant--->VARIANT(b) | | +-----------+ | VT_ARRAY| | | parray-----+
* +------------+
- *
+ *
* When previous objects are rereased by ComThread.Release(), first the
* VARIANT(a) is released by VariantClear() function, and second the VARIANT(b)
* is released by VariantClear() function too. But the SAFEARRAY was already
* released by the VARIANT(a).
- *
+ *
* So, in my enviroment (WinXP + J2SDK 1.4.1) the following java program is
* sometimes crash with EXCEPTION_ACCESS_VIOLATION.
- *
- *
+ *
+ *
* To solve this problem, it is nessesary to copy the SAFEARRAY like this:
- *
+ *
* +-----------+ |Variant | +------------+ | m_pVariant--->VARIANT(a) |
* +-----------+ | VT_ARRAY| +---------+ | parray---->SAFEARRAY| +------------+
* +|--------+ | +-----------+ | copySA() |SafeArray | +------------+ | |
* m_pV--->VARIANT(b) | V +-----------+ | VT_ARRAY| +---------+ |
* parray---->SAFEARRAY| +------------+ +---------+
- *
+ *
*
* May need to run with some command line options (including from inside
* Eclipse). Look in the docs area at the Jacob usage document for command line
@@ -58,6 +60,7 @@ public class SafeArrayReleaseTest extends BaseTestCase {
/**
* verifies the release works on SafeArray
*/
+ @Test
public void testSaveArrayRelease() {
int count;
System.out.println("Starting test for max = " + MAX);
diff --git a/src/test/com/jacob/test/safearray/SafeArrayStringConstructorTest.java b/src/test/com/jacob/test/safearray/SafeArrayStringConstructorTest.java
index 293bf6e..3423616 100644
--- a/src/test/com/jacob/test/safearray/SafeArrayStringConstructorTest.java
+++ b/src/test/com/jacob/test/safearray/SafeArrayStringConstructorTest.java
@@ -1,11 +1,13 @@
package com.jacob.test.safearray;
+import org.junit.Test;
+
import com.jacob.com.SafeArray;
import com.jacob.test.BaseTestCase;
/**
* Test case provided #41 Fix for SafeArray(String) constructor
- *
+ *
* In the current release of Jacob, SafeArray.java contains a constructor which
* takes a string as a single argument. The documentation claims that this
* method converts a string to a VT_UI1 array. Using this method as written
@@ -13,6 +15,8 @@
* from Java chars, which are 16-bit unsigned integers (which would be VT_UI2).
*/
public class SafeArrayStringConstructorTest extends BaseTestCase {
+
+ @Test
public void testStringConstructor() {
// The line below will throw ComFailException using jacob 1.17-M2
// without the patch.
diff --git a/src/test/com/jacob/test/safearray/SafeArrayViaExcel.java b/src/test/com/jacob/test/safearray/SafeArrayViaExcelTest.java
similarity index 96%
rename from src/test/com/jacob/test/safearray/SafeArrayViaExcel.java
rename to src/test/com/jacob/test/safearray/SafeArrayViaExcelTest.java
index d71a612..9ff6bee 100644
--- a/src/test/com/jacob/test/safearray/SafeArrayViaExcel.java
+++ b/src/test/com/jacob/test/safearray/SafeArrayViaExcelTest.java
@@ -1,5 +1,7 @@
package com.jacob.test.safearray;
+import org.junit.Test;
+
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.Dispatch;
import com.jacob.com.SafeArray;
@@ -15,11 +17,12 @@
*
* This relies on BaseTestCase to provide the root path to the file under test
*/
-public class SafeArrayViaExcel extends BaseTestCase {
+public class SafeArrayViaExcelTest extends BaseTestCase {
/**
* verify safe arrays work with standard applications, Excel in this case
*/
+ @Test
public void testSafeArrayViaExcel() {
ActiveXComponent xl = new ActiveXComponent("Excel.Application");
diff --git a/src/test/com/jacob/test/vbscript/ScriptTest.java b/src/test/com/jacob/test/vbscript/ScriptTest.java
index 755f8d4..cc6314a 100644
--- a/src/test/com/jacob/test/vbscript/ScriptTest.java
+++ b/src/test/com/jacob/test/vbscript/ScriptTest.java
@@ -1,5 +1,7 @@
package com.jacob.test.vbscript;
+import org.junit.Test;
+
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.ComException;
import com.jacob.com.ComThread;
@@ -18,6 +20,7 @@
*/
public class ScriptTest extends BaseTestCase {
+ @Test
public void testStupidSpeedTest() {
String lang = "VBScript";
ActiveXComponent sC = new ActiveXComponent("ScriptControl");
@@ -28,6 +31,7 @@ public void testStupidSpeedTest() {
}
}
+ @Test
public void testCreatingDispatchEvents() {
ComThread.InitSTA(true);
DispatchEvents de = null;
diff --git a/src/test/com/jacob/test/vbscript/ScriptTest2.java b/src/test/com/jacob/test/vbscript/ScriptTest2.java
index 0fe91ea..f7e05d2 100644
--- a/src/test/com/jacob/test/vbscript/ScriptTest2.java
+++ b/src/test/com/jacob/test/vbscript/ScriptTest2.java
@@ -1,5 +1,7 @@
package com.jacob.test.vbscript;
+import org.junit.Test;
+
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.ComException;
import com.jacob.com.ComThread;
@@ -33,6 +35,7 @@
*/
public class ScriptTest2 extends BaseTestCase {
+ @Test
public void testScript2() {
try {
ComThread.InitSTA();
diff --git a/src/test/com/jacob/test/vbscript/ScriptTest2ActiveX.java b/src/test/com/jacob/test/vbscript/ScriptTest2ActiveX.java
index 58c7898..b50f373 100644
--- a/src/test/com/jacob/test/vbscript/ScriptTest2ActiveX.java
+++ b/src/test/com/jacob/test/vbscript/ScriptTest2ActiveX.java
@@ -1,5 +1,7 @@
package com.jacob.test.vbscript;
+import org.junit.Test;
+
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.ComException;
import com.jacob.com.ComThread;
@@ -37,6 +39,7 @@ public class ScriptTest2ActiveX extends BaseTestCase {
public static DispatchProxy sCon = null;
+ @Test
public void testActiveXSTA() {
try {
ComThread.InitSTA();
diff --git a/src/test/com/jacob/test/vbscript/ScriptTest3.java b/src/test/com/jacob/test/vbscript/ScriptTest3.java
index 2745ec6..6b8608c 100644
--- a/src/test/com/jacob/test/vbscript/ScriptTest3.java
+++ b/src/test/com/jacob/test/vbscript/ScriptTest3.java
@@ -1,5 +1,7 @@
package com.jacob.test.vbscript;
+import org.junit.Test;
+
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.ComException;
import com.jacob.com.ComThread;
@@ -28,6 +30,7 @@ public class ScriptTest3 extends BaseTestCase {
public static boolean quit = false;
+ @Test
public void testScript() {
try {
ComThread.InitMTA();
diff --git a/src/test/com/jacob/test/vbscript/ScriptTest3ActiveX.java b/src/test/com/jacob/test/vbscript/ScriptTest3ActiveX.java
index e75b268..f05cf20 100644
--- a/src/test/com/jacob/test/vbscript/ScriptTest3ActiveX.java
+++ b/src/test/com/jacob/test/vbscript/ScriptTest3ActiveX.java
@@ -1,5 +1,7 @@
package com.jacob.test.vbscript;
+import org.junit.Test;
+
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.ComException;
import com.jacob.com.ComThread;
@@ -24,6 +26,7 @@ public class ScriptTest3ActiveX extends BaseTestCase {
public static boolean quit = false;
+ @Test
public void testYetAnotherScriptTest() {
try {
ComThread.InitMTA();
diff --git a/src/test/com/jacob/test/vbscript/ScriptTestActiveX.java b/src/test/com/jacob/test/vbscript/ScriptTestActiveX.java
index 210db85..187437b 100644
--- a/src/test/com/jacob/test/vbscript/ScriptTestActiveX.java
+++ b/src/test/com/jacob/test/vbscript/ScriptTestActiveX.java
@@ -1,5 +1,7 @@
package com.jacob.test.vbscript;
+import org.junit.Test;
+
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.ComException;
import com.jacob.com.ComThread;
@@ -16,6 +18,8 @@
* options.
*/
public class ScriptTestActiveX extends BaseTestCase {
+
+ @Test
public void testActiveXScript() {
ComThread.InitSTA(true);
DispatchEvents de = null;
diff --git a/src/test/com/jacob/test/vbscript/ScriptTestErrEvents.java b/src/test/com/jacob/test/vbscript/ScriptTestErrEvents.java
index c0700bf..ce829a1 100644
--- a/src/test/com/jacob/test/vbscript/ScriptTestErrEvents.java
+++ b/src/test/com/jacob/test/vbscript/ScriptTestErrEvents.java
@@ -1,13 +1,12 @@
package com.jacob.test.vbscript;
import com.jacob.com.Variant;
-import com.jacob.test.BaseTestCase;
/**
* Extracted from ScriptTest so everyone can see this Made a test solely because
* it made the ant test easier
*/
-public class ScriptTestErrEvents extends BaseTestCase {
+public class ScriptTestErrEvents {
public void Error(Variant[] args) {
System.out.println("java callback for error!");
diff --git a/src/test/com/jacob/test/windowsmedia/WMPlayer.java b/src/test/com/jacob/test/windowsmedia/WMPlayer.java
index 0cd6237..3326201 100644
--- a/src/test/com/jacob/test/windowsmedia/WMPlayer.java
+++ b/src/test/com/jacob/test/windowsmedia/WMPlayer.java
@@ -7,12 +7,14 @@
*
* this doesn't actually play for some reason. It always says the length is 0.
*
- * May need to run with some command line options (including from inside Eclipse).
+ * May need to run with some command line options (including from inside Eclipse).
* Look in the docs area at the Jacob usage document for command line options.
*
*/
import java.io.File;
+import org.junit.Test;
+
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.Dispatch;
import com.jacob.com.Variant;
@@ -23,6 +25,7 @@ public class WMPlayer extends BaseTestCase {
/**
* This should demo the media player but it doesn't
*/
+ @Test
public void testOpenWMPlayer() {
// this file exists in windows 7 installations
File file = new File(