Migrate Mockito-effected test classes to JUnit 5

This commit is contained in:
abilan
2022-12-21 09:42:18 -05:00
parent eb570ec447
commit 033cb7695b
7 changed files with 80 additions and 123 deletions

View File

@@ -43,6 +43,7 @@
<int:channel id="input"/>
<bean id="locker" class="org.mockito.Mockito" factory-method="mock">
<constructor-arg value="org.springframework.integration.file.locking.AbstractFileLockerFilter"/>
<constructor-arg value="org.springframework.integration.file.locking.AbstractFileLockerFilter"
type="java.lang.Class"/>
</bean>
</beans>

View File

@@ -16,27 +16,25 @@
package org.springframework.integration.file.config;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.integration.file.locking.NioFileLocker;
import org.springframework.integration.test.util.TestUtils;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import static org.assertj.core.api.Assertions.assertThat;
/**
* @author Oleg Zhurakousky
* @author Gunnar Hillert
* @author Artem Bilan
*
*/
@ContextConfiguration
@RunWith(SpringJUnit4ClassRunner.class)
@SpringJUnitConfig
public class InboundAdapterWithLockersTests {
@Autowired(required = true)
@Autowired
private ApplicationContext context;
@Test
@@ -45,9 +43,9 @@ public class InboundAdapterWithLockersTests {
.isEqualTo(context.getBean("locker"));
assertThat(TestUtils.getPropertyValue(context.getBean("inputWithLockerB"), "source.scanner.locker"))
.isEqualTo(context.getBean("locker"));
assertThat(TestUtils.getPropertyValue(context.getBean("inputWithLockerC"), "source.scanner.locker")
instanceof NioFileLocker).isTrue();
assertThat(TestUtils.getPropertyValue(context.getBean("inputWithLockerD"), "source.scanner.locker")
instanceof NioFileLocker).isTrue();
assertThat(TestUtils.getPropertyValue(context.getBean("inputWithLockerC"), "source.scanner.locker"))
.isInstanceOf(NioFileLocker.class);
assertThat(TestUtils.getPropertyValue(context.getBean("inputWithLockerD"), "source.scanner.locker"))
.isInstanceOf(NioFileLocker.class);
}
}