You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shiro.apache.org by GitBox <gi...@apache.org> on 2020/07/05 13:01:28 UTC

[GitHub] [shiro] bmhm commented on a change in pull request #240: [SHIRO-778] onInit method on AuthenticatingRealm is called twice

bmhm commented on a change in pull request #240:
URL: https://github.com/apache/shiro/pull/240#discussion_r449874922



##########
File path: config/ogdl/src/test/groovy/org/apache/shiro/config/ogdl/ReflectionBuilderTest.groovy
##########
@@ -640,6 +643,20 @@ class ReflectionBuilderTest {
         assertNotNull(beanMap.get("two"))
     }
 
+    @Test
+    void testNotMultipleInitialization() {
+        // given
+        Map<String, String> defs = new ConcurrentHashMap<>()
+        defs.put("initcountbean", InitCountBean.getCanonicalName())
+        ReflectionBuilder builder = new ReflectionBuilder()
+
+        // when
+        builder.buildObjects(defs);
+
+        // then
+        assertEquals(1, InitCountBean.getInitCount())
+    }
+

Review comment:
       Can you add a test where `buildObjects(null)` is called FIRST? Because that actually happens in Shiro.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org