From 9e8e8fac17dccbe7e6dc9c4b2c50e8141ad88b45 Mon Sep 17 00:00:00 2001 From: liaozan <378024053@qq.com> Date: Tue, 20 Sep 2022 00:29:08 +0800 Subject: [PATCH] Add unit test in BeanRegistrationUtilTest --- .../apollo/spring/util/BeanRegistrationUtilTest.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/apollo-client/src/test/java/com/ctrip/framework/apollo/spring/util/BeanRegistrationUtilTest.java b/apollo-client/src/test/java/com/ctrip/framework/apollo/spring/util/BeanRegistrationUtilTest.java index 6a63ea909fc..ff7aa2241af 100644 --- a/apollo-client/src/test/java/com/ctrip/framework/apollo/spring/util/BeanRegistrationUtilTest.java +++ b/apollo-client/src/test/java/com/ctrip/framework/apollo/spring/util/BeanRegistrationUtilTest.java @@ -50,7 +50,6 @@ public void registerBeanDefinitionIfNotExistsTest() { getClass(), null)); assertFalse(BeanRegistrationUtil.registerBeanDefinitionIfNotExists(someRegistry, someBeanName, getClass())); - } @Test @@ -58,7 +57,6 @@ public void registerBeanDefinitionIfNotExistsBeanNotPresentTest() { someRegistry.registerBeanDefinition("someAnotherBean", Mockito.mock(BeanDefinition.class)); assertTrue(BeanRegistrationUtil.registerBeanDefinitionIfNotExists(someRegistry, someBeanName, getClass(), null)); - } @Test @@ -68,7 +66,12 @@ public void registerBeanDefinitionIfNotExistsWithExtPropTest() { extraPropertyValues.put(someBeanName, "someProperty"); assertTrue(BeanRegistrationUtil.registerBeanDefinitionIfNotExists(someRegistry, someBeanName, getClass(), extraPropertyValues)); + } + @Test + public void registerBeanDefinitionIfNotExistsWithoutBeanNameTest() { + someRegistry.registerBeanDefinition(BeanDefinition.class.getName(), Mockito.mock(BeanDefinition.class)); + assertFalse(BeanRegistrationUtil.registerBeanDefinitionIfNotExists(someRegistry, BeanDefinition.class)); } -} +} \ No newline at end of file