Skip to content

Commit

Permalink
Fix uts
Browse files Browse the repository at this point in the history
  • Loading branch information
AlbumenJ committed Jun 28, 2023
1 parent 28ccb13 commit e3b69e6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -181,23 +181,23 @@ static ReferenceAnnotationBeanPostProcessor getReferenceAnnotationBeanPostProces

static DubboSpringInitContext getInitializationContext(BeanFactory beanFactory) {
String beanName = DubboSpringInitContext.class.getName();
if (beanFactory.containsBean(beanName)) {
if (beanFactory != null && beanFactory.containsBean(beanName)) {
return beanFactory.getBean(beanName, DubboSpringInitContext.class);
}
return null;
}

static ApplicationModel getApplicationModel(BeanFactory beanFactory) {
String beanName = ApplicationModel.class.getName();
if (beanFactory.containsBean(beanName)) {
if (beanFactory != null && beanFactory.containsBean(beanName)) {
return beanFactory.getBean(beanName, ApplicationModel.class);
}
return null;
}

static ModuleModel getModuleModel(BeanFactory beanFactory) {
String beanName = ModuleModel.class.getName();
if (beanFactory.containsBean(beanName)) {
if (beanFactory != null && beanFactory.containsBean(beanName)) {
return beanFactory.getBean(beanName, ModuleModel.class);
}
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void tearDown() {
@Test
void testGetService() {
TestService service = mock(TestService.class);
ServiceBean serviceBean = new ServiceBean(service);
ServiceBean serviceBean = new ServiceBean(null, service);

Service beanService = serviceBean.getService();
MatcherAssert.assertThat(beanService, not(nullValue()));
Expand All @@ -52,4 +52,4 @@ void testGetService() {
abstract class TestService implements Service {

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class DataSourceStatusCheckerTest {
public void setUp() throws Exception {
initMocks(this);
this.dataSourceStatusChecker = new DataSourceStatusChecker(applicationContext);
new ServiceBean<Object>().setApplicationContext(applicationContext);
new ServiceBean<Object>(applicationContext).setApplicationContext(applicationContext);
}

@AfterEach
Expand Down Expand Up @@ -105,4 +105,4 @@ void testWithDatasourceNotHasNextResult() throws SQLException {

assertThat(status.getLevel(), is(Status.Level.ERROR));
}
}
}

0 comments on commit e3b69e6

Please sign in to comment.