|
|
@ -16,15 +16,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
package org.springframework.boot.test;
|
|
|
|
package org.springframework.boot.test;
|
|
|
|
|
|
|
|
|
|
|
|
import static org.mockito.BDDMockito.given;
|
|
|
|
|
|
|
|
import static org.mockito.Mockito.*;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.junit.Test;
|
|
|
|
import org.junit.Test;
|
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.context.ApplicationContext;
|
|
|
|
import org.springframework.context.ApplicationContext;
|
|
|
|
import org.springframework.context.ConfigurableApplicationContext;
|
|
|
|
import org.springframework.context.ConfigurableApplicationContext;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import static org.mockito.BDDMockito.given;
|
|
|
|
|
|
|
|
import static org.mockito.Mockito.mock;
|
|
|
|
|
|
|
|
import static org.mockito.Mockito.verify;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Tests for {@link ApplicationContextTestUtils}.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @author Stephane Nicoll
|
|
|
|
* @author Stephane Nicoll
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -32,7 +33,7 @@ public class ApplicationContextTestUtilsTests {
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void closeNull() {
|
|
|
|
public void closeNull() {
|
|
|
|
ApplicationContextTestUtils.closeAll(null);
|
|
|
|
ApplicationContextTestUtils.closeAll(null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
@ -47,7 +48,6 @@ public class ApplicationContextTestUtilsTests {
|
|
|
|
ConfigurableApplicationContext parent = mock(ConfigurableApplicationContext.class);
|
|
|
|
ConfigurableApplicationContext parent = mock(ConfigurableApplicationContext.class);
|
|
|
|
given(mock.getParent()).willReturn(parent);
|
|
|
|
given(mock.getParent()).willReturn(parent);
|
|
|
|
given(parent.getParent()).willReturn(null);
|
|
|
|
given(parent.getParent()).willReturn(null);
|
|
|
|
|
|
|
|
|
|
|
|
ApplicationContextTestUtils.closeAll(mock);
|
|
|
|
ApplicationContextTestUtils.closeAll(mock);
|
|
|
|
verify(mock).getParent();
|
|
|
|
verify(mock).getParent();
|
|
|
|
verify(mock).close();
|
|
|
|
verify(mock).close();
|
|
|
|