-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OSGiWeavingAdaptorTest: cosmetic improvements
Signed-off-by: Alexander Kriegisch <[email protected]>
- Loading branch information
Showing
1 changed file
with
16 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ | |
|
||
/** | ||
* Test for the OSGiWeavingAdaptor | ||
* | ||
* | ||
* @author Stefan Winkler <[email protected]> | ||
*/ | ||
public class OSGiWeavingAdaptorTest extends TestCase { | ||
|
@@ -37,7 +37,7 @@ public class OSGiWeavingAdaptorTest extends TestCase { | |
* Test for https://github.com/eclipse-aspectj/ajdt/issues/45 | ||
*/ | ||
public void testGeneratedClasses() throws Exception { | ||
// GIVEN: | ||
// GIVEN: | ||
// - an OSGiWeavingAdaptor instance | ||
final OSGiWeavingAdaptor adaptor = new OSGiWeavingAdaptor(null, null, "dummy"); | ||
|
||
|
@@ -57,11 +57,11 @@ public void acceptClass(String name, byte[] originalBytes, | |
} | ||
}); | ||
|
||
// WHEN: | ||
// - the class is woven | ||
// WHEN: | ||
// - the class is woven | ||
|
||
// (Trying to mock the handling is too complex, so instead, we provide a valid .class file | ||
// here. This is enough to not throw an exception along the way. Other than that, we don't care about the | ||
// here. This is enough to not throw an exception along the way. Other than that, we don't care about the | ||
// classBytes. It's the keys of the generatedClasses field set by the getWovenBytes() method, we are interested in...) | ||
// So, read our own .class file here: | ||
byte[] classBytes; | ||
|
@@ -77,7 +77,7 @@ public void acceptClass(String name, byte[] originalBytes, | |
getWovenBytes.setAccessible(true); | ||
getWovenBytes.invoke(adaptor, "my.foo.MyClass", classBytes); // WeavingAdaptor:385 | ||
|
||
// - then the woven class would be defined, which causes another call to getWovenBytes() | ||
// - then the woven class would be defined, which causes another call to getWovenBytes() | ||
// but this time for the base class. Before that call, the delegateForCurrentClass is reset to null | ||
|
||
Field delegateForCurrentClassField = WeavingAdaptor.class.getDeclaredField("delegateForCurrentClass"); | ||
|
@@ -90,7 +90,7 @@ public void acceptClass(String name, byte[] originalBytes, | |
|
||
// THEN: | ||
// - the result should not include the non-generated class, only the four generated ones | ||
|
||
// build a string representation to provide details in the assertion message | ||
StringBuilder actualContentsBuilder = new StringBuilder("["); | ||
for (String key : actualResult.keySet()) { | ||
|
@@ -100,15 +100,15 @@ public void acceptClass(String name, byte[] originalBytes, | |
String actualContents = actualContentsBuilder.toString(); | ||
|
||
// assert our expected result | ||
assertTrue("my.foo.MyClass$AjcClosure1 is not contained in " + actualContents.toString(), | ||
actualResult.keySet().contains("my.foo.MyClass$AjcClosure1")); | ||
assertTrue("my.foo.MyClass$AjcClosure3 is not contained in " + actualContents.toString(), | ||
actualResult.keySet().contains("my.foo.MyClass$AjcClosure3")); | ||
assertTrue("my.foo.MyBaseClass$AjcClosure1 is not contained in " + actualContents.toString(), | ||
actualResult.keySet().contains("my.foo.MyBaseClass$AjcClosure1")); | ||
assertTrue("my.foo.MyBaseClass$AjcClosure3 is not contained in " + actualContents.toString(), | ||
actualResult.keySet().contains("my.foo.MyBaseClass$AjcClosure3")); | ||
assertEquals("Expected size 4 of result " + actualContents.toString(), | ||
assertTrue("my.foo.MyClass$AjcClosure1 is not contained in " + actualContents, | ||
actualResult.containsKey("my.foo.MyClass$AjcClosure1")); | ||
assertTrue("my.foo.MyClass$AjcClosure3 is not contained in " + actualContents, | ||
actualResult.containsKey("my.foo.MyClass$AjcClosure3")); | ||
assertTrue("my.foo.MyBaseClass$AjcClosure1 is not contained in " + actualContents, | ||
actualResult.containsKey("my.foo.MyBaseClass$AjcClosure1")); | ||
assertTrue("my.foo.MyBaseClass$AjcClosure3 is not contained in " + actualContents, | ||
actualResult.containsKey("my.foo.MyBaseClass$AjcClosure3")); | ||
assertEquals("Expected size 4 of result " + actualContents, | ||
4, actualResult.size()); | ||
} | ||
} |