Remove some deprecated APIs from tests
The following deprecated APIs are not in use anymore in the project's tests: - `org.junit.rules.ExpectedException#none` - `org.mockito.MockitoAnnotations#initMocks` - `org.mockito.Mockito#verifyZeroInteractions` Issue #3838
This commit is contained in:
committed by
Mahmoud Ben Hassine
parent
7242f8fe77
commit
24422b5163
@@ -16,23 +16,20 @@
|
||||
package org.springframework.batch.test.context;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.ExpectedException;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.support.GenericApplicationContext;
|
||||
import org.springframework.test.context.MergedContextConfiguration;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
/**
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
public class BatchTestContextCustomizerTest {
|
||||
|
||||
@Rule
|
||||
public ExpectedException expectedException = ExpectedException.none();
|
||||
|
||||
private BatchTestContextCustomizer contextCustomizer = new BatchTestContextCustomizer();
|
||||
|
||||
@Test
|
||||
@@ -54,13 +51,12 @@ public class BatchTestContextCustomizerTest {
|
||||
// given
|
||||
ConfigurableApplicationContext context = Mockito.mock(ConfigurableApplicationContext.class);
|
||||
MergedContextConfiguration mergedConfig = Mockito.mock(MergedContextConfiguration.class);
|
||||
this.expectedException.expect(IllegalArgumentException.class);
|
||||
this.expectedException.expectMessage("The bean factory must be an instance of BeanDefinitionRegistry");
|
||||
|
||||
// when
|
||||
this.contextCustomizer.customizeContext(context, mergedConfig);
|
||||
final Exception expectedException = Assert.assertThrows(IllegalArgumentException.class,
|
||||
() -> this.contextCustomizer.customizeContext(context, mergedConfig));
|
||||
|
||||
// then
|
||||
// expected exception
|
||||
assertEquals("The bean factory must be an instance of BeanDefinitionRegistry", expectedException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user