You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2015/08/16 10:18:13 UTC
svn commit: r1696116 -
/commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/
Author: sebb
Date: Sun Aug 16 08:18:12 2015
New Revision: 1696116
URL: http://svn.apache.org/r1696116
Log:
Extract common test package base name and eliminate dependency on actual package name
Modified:
commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestArrayAccess02Creator.java
commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestArrayAccess03Creator.java
commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestArrayAccess04Creator.java
commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestCreator.java
commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestReturn01Creator.java
commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestReturn03Creator.java
Modified: commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestArrayAccess02Creator.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestArrayAccess02Creator.java?rev=1696116&r1=1696115&r2=1696116&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestArrayAccess02Creator.java (original)
+++ commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestArrayAccess02Creator.java Sun Aug 16 08:18:12 2015
@@ -39,7 +39,7 @@ public class TestArrayAccess02Creator ex
private ClassGen _cg;
public TestArrayAccess02Creator() {
- _cg = new ClassGen("org.apache.commons.bcel6.verifier.tests.TestArrayAccess02", "java.lang.Object", "TestArrayAccess02.java", Constants.ACC_PUBLIC | Constants.ACC_SUPER, new String[] { });
+ _cg = new ClassGen(TEST_PACKAGE+".TestArrayAccess02", "java.lang.Object", "TestArrayAccess02.java", Constants.ACC_PUBLIC | Constants.ACC_SUPER, new String[] { });
_cp = _cg.getConstantPool();
_factory = new InstructionFactory(_cg, _cp);
@@ -54,7 +54,7 @@ public void create(OutputStream out) thr
private void createMethod_0() {
InstructionList il = new InstructionList();
- MethodGen method = new MethodGen(Constants.ACC_PUBLIC, Type.VOID, Type.NO_ARGS, new String[] { }, "<init>", "org.apache.commons.bcel6.verifier.tests.TestArrayAccess02", il, _cp);
+ MethodGen method = new MethodGen(Constants.ACC_PUBLIC, Type.VOID, Type.NO_ARGS, new String[] { }, "<init>", TEST_PACKAGE+".TestArrayAccess02", il, _cp);
InstructionHandle ih_0 = il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
Assert.assertNotNull(ih_0); // TODO why is this not used
@@ -69,11 +69,11 @@ public void create(OutputStream out) thr
private void createMethod_1() {
InstructionList il = new InstructionList();
- MethodGen method = new MethodGen(Constants.ACC_PUBLIC | Constants.ACC_STATIC, Type.VOID, Type.NO_ARGS, new String[] { }, "test", "org.apache.commons.bcel6.verifier.tests.TestArrayAccess02", il, _cp);
+ MethodGen method = new MethodGen(Constants.ACC_PUBLIC | Constants.ACC_STATIC, Type.VOID, Type.NO_ARGS, new String[] { }, "test", TEST_PACKAGE+".TestArrayAccess02", il, _cp);
InstructionHandle ih_0 = il.append(new PUSH(_cp, 1));
Assert.assertNotNull(ih_0); // TODO why is this not used
- il.append(_factory.createNewArray(new ObjectType("org.apache.commons.bcel6.verifier.tests.TestArrayAccess02"), (short) 1));
+ il.append(_factory.createNewArray(new ObjectType(TEST_PACKAGE+".TestArrayAccess02"), (short) 1));
il.append(InstructionFactory.createStore(Type.OBJECT, 0));
InstructionHandle ih_5 = il.append(new PUSH(_cp, 1));
Assert.assertNotNull(ih_5); // TODO why is this not used
@@ -82,9 +82,9 @@ public void create(OutputStream out) thr
InstructionHandle ih_10 = il.append(InstructionFactory.createLoad(Type.OBJECT, 1));
Assert.assertNotNull(ih_10); // TODO why is this not used
il.append(new PUSH(_cp, 0));
- il.append(_factory.createNew("org.apache.commons.bcel6.verifier.tests.TestArrayAccess02"));
+ il.append(_factory.createNew(TEST_PACKAGE+".TestArrayAccess02"));
il.append(InstructionConstants.DUP);
- il.append(_factory.createInvoke("org.apache.commons.bcel6.verifier.tests.TestArrayAccess02", "<init>", Type.VOID, Type.NO_ARGS, Constants.INVOKESPECIAL));
+ il.append(_factory.createInvoke(TEST_PACKAGE+".TestArrayAccess02", "<init>", Type.VOID, Type.NO_ARGS, Constants.INVOKESPECIAL));
il.append(InstructionConstants.AASTORE);
InstructionHandle ih_20 = il.append(InstructionFactory.createReturn(Type.VOID));
Assert.assertNotNull(ih_20); // TODO why is this not used
Modified: commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestArrayAccess03Creator.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestArrayAccess03Creator.java?rev=1696116&r1=1696115&r2=1696116&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestArrayAccess03Creator.java (original)
+++ commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestArrayAccess03Creator.java Sun Aug 16 08:18:12 2015
@@ -39,7 +39,7 @@ public class TestArrayAccess03Creator ex
private ClassGen _cg;
public TestArrayAccess03Creator() {
- _cg = new ClassGen("org.apache.commons.bcel6.verifier.tests.TestArrayAccess03", "java.lang.Object", "TestArrayAccess03.java", Constants.ACC_PUBLIC | Constants.ACC_SUPER, new String[] { });
+ _cg = new ClassGen(TEST_PACKAGE+".TestArrayAccess03", "java.lang.Object", "TestArrayAccess03.java", Constants.ACC_PUBLIC | Constants.ACC_SUPER, new String[] { });
_cp = _cg.getConstantPool();
_factory = new InstructionFactory(_cg, _cp);
@@ -54,7 +54,7 @@ public void create(OutputStream out) thr
private void createMethod_0() {
InstructionList il = new InstructionList();
- MethodGen method = new MethodGen(Constants.ACC_PUBLIC, Type.VOID, Type.NO_ARGS, new String[] { }, "<init>", "org.apache.commons.bcel6.verifier.tests.TestArrayAccess03", il, _cp);
+ MethodGen method = new MethodGen(Constants.ACC_PUBLIC, Type.VOID, Type.NO_ARGS, new String[] { }, "<init>", TEST_PACKAGE+".TestArrayAccess03", il, _cp);
InstructionHandle ih_0 = il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
Assert.assertNotNull(ih_0); // TODO why is this not used
@@ -69,18 +69,18 @@ public void create(OutputStream out) thr
private void createMethod_1() {
InstructionList il = new InstructionList();
- MethodGen method = new MethodGen(Constants.ACC_PUBLIC | Constants.ACC_STATIC, Type.VOID, new Type[] { Type.OBJECT }, new String[] { "arg0" }, "test", "org.apache.commons.bcel6.verifier.tests.TestArrayAccess03", il, _cp);
+ MethodGen method = new MethodGen(Constants.ACC_PUBLIC | Constants.ACC_STATIC, Type.VOID, new Type[] { Type.OBJECT }, new String[] { "arg0" }, "test", TEST_PACKAGE+".TestArrayAccess03", il, _cp);
InstructionHandle ih_0 = il.append(new PUSH(_cp, 1));
Assert.assertNotNull(ih_0); // TODO why is this not used
- il.append(_factory.createNewArray(new ObjectType("org.apache.commons.bcel6.verifier.tests.TestArrayAccess03"), (short) 1));
+ il.append(_factory.createNewArray(new ObjectType(TEST_PACKAGE+".TestArrayAccess03"), (short) 1));
il.append(InstructionFactory.createStore(Type.OBJECT, 1));
InstructionHandle ih_5 = il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
Assert.assertNotNull(ih_5); // TODO why is this not used
il.append(new PUSH(_cp, 0));
- il.append(_factory.createNew("org.apache.commons.bcel6.verifier.tests.TestArrayAccess03"));
+ il.append(_factory.createNew(TEST_PACKAGE+".TestArrayAccess03"));
il.append(InstructionConstants.DUP);
- il.append(_factory.createInvoke("org.apache.commons.bcel6.verifier.tests.TestArrayAccess03", "<init>", Type.VOID, Type.NO_ARGS, Constants.INVOKESPECIAL));
+ il.append(_factory.createInvoke(TEST_PACKAGE+".TestArrayAccess03", "<init>", Type.VOID, Type.NO_ARGS, Constants.INVOKESPECIAL));
il.append(InstructionConstants.AASTORE);
InstructionHandle ih_15 = il.append(InstructionFactory.createReturn(Type.VOID));
Assert.assertNotNull(ih_15); // TODO why is this not used
Modified: commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestArrayAccess04Creator.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestArrayAccess04Creator.java?rev=1696116&r1=1696115&r2=1696116&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestArrayAccess04Creator.java (original)
+++ commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestArrayAccess04Creator.java Sun Aug 16 08:18:12 2015
@@ -37,7 +37,7 @@ public class TestArrayAccess04Creator ex
private ClassGen _cg;
public TestArrayAccess04Creator() {
- _cg = new ClassGen("org.apache.commons.bcel6.verifier.tests.TestArrayAccess04", "java.lang.Object", "TestArrayAccess04.java", Constants.ACC_PUBLIC | Constants.ACC_SUPER, new String[] { });
+ _cg = new ClassGen(TEST_PACKAGE+".TestArrayAccess04", "java.lang.Object", "TestArrayAccess04.java", Constants.ACC_PUBLIC | Constants.ACC_SUPER, new String[] { });
_cp = _cg.getConstantPool();
_factory = new InstructionFactory(_cg, _cp);
@@ -52,7 +52,7 @@ public void create(OutputStream out) thr
private void createMethod_0() {
InstructionList il = new InstructionList();
- MethodGen method = new MethodGen(Constants.ACC_PUBLIC, Type.VOID, Type.NO_ARGS, new String[] { }, "<init>", "org.apache.commons.bcel6.verifier.tests.TestArrayAccess04", il, _cp);
+ MethodGen method = new MethodGen(Constants.ACC_PUBLIC, Type.VOID, Type.NO_ARGS, new String[] { }, "<init>", TEST_PACKAGE+".TestArrayAccess04", il, _cp);
InstructionHandle ih_0 = il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
Assert.assertNotNull(ih_0); // TODO why is this not used
@@ -67,7 +67,7 @@ public void create(OutputStream out) thr
private void createMethod_1() {
InstructionList il = new InstructionList();
- MethodGen method = new MethodGen(Constants.ACC_PUBLIC | Constants.ACC_STATIC, Type.VOID, new Type[] { Type.OBJECT }, new String[] { "arg0" }, "test", "org.apache.commons.bcel6.verifier.tests.TestArrayAccess04", il, _cp);
+ MethodGen method = new MethodGen(Constants.ACC_PUBLIC | Constants.ACC_STATIC, Type.VOID, new Type[] { Type.OBJECT }, new String[] { "arg0" }, "test", TEST_PACKAGE+".TestArrayAccess04", il, _cp);
InstructionHandle ih_0 = il.append(new PUSH(_cp, 1));
Assert.assertNotNull(ih_0); // TODO why is this not used
Modified: commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestCreator.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestCreator.java?rev=1696116&r1=1696115&r2=1696116&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestCreator.java (original)
+++ commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestCreator.java Sun Aug 16 08:18:12 2015
@@ -25,6 +25,9 @@ import java.net.URISyntaxException;
*/
public abstract class TestCreator {
+ // Common package base name for generated test classes
+ protected static final String TEST_PACKAGE = TestCreator.class.getPackage().getName();
+
public void create() throws IOException {
File classFile = new File(getPackageFolder(), getClassName());
FileOutputStream out = new FileOutputStream(classFile);
Modified: commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestReturn01Creator.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestReturn01Creator.java?rev=1696116&r1=1696115&r2=1696116&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestReturn01Creator.java (original)
+++ commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestReturn01Creator.java Sun Aug 16 08:18:12 2015
@@ -37,7 +37,7 @@ public class TestReturn01Creator extends
private ClassGen _cg;
public TestReturn01Creator() {
- _cg = new ClassGen("org.apache.commons.bcel6.verifier.tests.TestReturn01", "java.lang.Object", "TestReturn01.java", Constants.ACC_PUBLIC | Constants.ACC_SUPER, new String[] { });
+ _cg = new ClassGen(TEST_PACKAGE+".TestReturn01", "java.lang.Object", "TestReturn01.java", Constants.ACC_PUBLIC | Constants.ACC_SUPER, new String[] { });
_cp = _cg.getConstantPool();
_factory = new InstructionFactory(_cg, _cp);
@@ -52,7 +52,7 @@ public void create(OutputStream out) thr
private void createMethod_0() {
InstructionList il = new InstructionList();
- MethodGen method = new MethodGen(Constants.ACC_PUBLIC, Type.VOID, Type.NO_ARGS, new String[] { }, "<init>", "org.apache.commons.bcel6.verifier.tests.TestReturn01", il, _cp);
+ MethodGen method = new MethodGen(Constants.ACC_PUBLIC, Type.VOID, Type.NO_ARGS, new String[] { }, "<init>", TEST_PACKAGE+".TestReturn01", il, _cp);
InstructionHandle ih_0 = il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
Assert.assertNotNull(ih_0); // TODO why is this not used
@@ -67,7 +67,7 @@ public void create(OutputStream out) thr
private void createMethod_1() {
InstructionList il = new InstructionList();
- MethodGen method = new MethodGen(Constants.ACC_PUBLIC | Constants.ACC_STATIC, Type.VOID, Type.NO_ARGS, new String[] { }, "foo", "org.apache.commons.bcel6.verifier.tests.TestReturn01", il, _cp);
+ MethodGen method = new MethodGen(Constants.ACC_PUBLIC | Constants.ACC_STATIC, Type.VOID, Type.NO_ARGS, new String[] { }, "foo", TEST_PACKAGE+".TestReturn01", il, _cp);
InstructionHandle ih_0 = il.append(_factory.createNew("java.lang.Object"));
Assert.assertNotNull(ih_0); // TODO why is this not used
Modified: commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestReturn03Creator.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestReturn03Creator.java?rev=1696116&r1=1696115&r2=1696116&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestReturn03Creator.java (original)
+++ commons/proper/bcel/trunk/src/test/java/org/apache/commons/bcel6/verifier/tests/TestReturn03Creator.java Sun Aug 16 08:18:12 2015
@@ -37,7 +37,7 @@ public class TestReturn03Creator extends
private ClassGen _cg;
public TestReturn03Creator() {
- _cg = new ClassGen("org.apache.commons.bcel6.verifier.tests.TestReturn03", "java.lang.Object", "TestReturn03.java", Constants.ACC_PUBLIC | Constants.ACC_SUPER, new String[] { });
+ _cg = new ClassGen(TEST_PACKAGE+".TestReturn03", "java.lang.Object", "TestReturn03.java", Constants.ACC_PUBLIC | Constants.ACC_SUPER, new String[] { });
_cp = _cg.getConstantPool();
_factory = new InstructionFactory(_cg, _cp);
@@ -52,7 +52,7 @@ public void create(OutputStream out) thr
private void createMethod_0() {
InstructionList il = new InstructionList();
- MethodGen method = new MethodGen(Constants.ACC_PUBLIC, Type.VOID, Type.NO_ARGS, new String[] { }, "<init>", "org.apache.commons.bcel6.verifier.tests.TestReturn03", il, _cp);
+ MethodGen method = new MethodGen(Constants.ACC_PUBLIC, Type.VOID, Type.NO_ARGS, new String[] { }, "<init>", TEST_PACKAGE+".TestReturn03", il, _cp);
InstructionHandle ih_0 = il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
Assert.assertNotNull(ih_0); // TODO why is this not used
@@ -67,7 +67,7 @@ public void create(OutputStream out) thr
private void createMethod_1() {
InstructionList il = new InstructionList();
- MethodGen method = new MethodGen(Constants.ACC_PUBLIC | Constants.ACC_STATIC, Type.INT, Type.NO_ARGS, new String[] { }, "test3", "org.apache.commons.bcel6.verifier.tests.TestReturn03", il, _cp);
+ MethodGen method = new MethodGen(Constants.ACC_PUBLIC | Constants.ACC_STATIC, Type.INT, Type.NO_ARGS, new String[] { }, "test3", TEST_PACKAGE+".TestReturn03", il, _cp);
InstructionHandle ih_0 = il.append(InstructionConstants.ACONST_NULL);
Assert.assertNotNull(ih_0); // TODO why is this not used