From c1b89fae93a84a605a1e2c8dda418f21d1c142dc Mon Sep 17 00:00:00 2001 From: Alexander Kriegisch Date: Tue, 24 Oct 2023 10:18:23 +0700 Subject: [PATCH] OSGiWeavingAdaptorTest: cosmetic improvements Signed-off-by: Alexander Kriegisch --- .../aspectj/tests/OSGiWeavingAdaptorTest.java | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/org.eclipse.equinox.weaving.aspectj.tests/src/org/eclipse/equinox/weaving/aspectj/tests/OSGiWeavingAdaptorTest.java b/org.eclipse.equinox.weaving.aspectj.tests/src/org/eclipse/equinox/weaving/aspectj/tests/OSGiWeavingAdaptorTest.java index df18e5ec2..0ed3bd806 100644 --- a/org.eclipse.equinox.weaving.aspectj.tests/src/org/eclipse/equinox/weaving/aspectj/tests/OSGiWeavingAdaptorTest.java +++ b/org.eclipse.equinox.weaving.aspectj.tests/src/org/eclipse/equinox/weaving/aspectj/tests/OSGiWeavingAdaptorTest.java @@ -28,7 +28,7 @@ /** * Test for the OSGiWeavingAdaptor - * + * * @author Stefan Winkler */ 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()); } }