Updated all Junit tests to 5.x

resolves TASK-675
This commit is contained in:
Glenn Renfro
2020-06-17 16:38:20 -04:00
committed by Michael Minella
parent f3bbc37293
commit 59c9adf047
74 changed files with 617 additions and 534 deletions

View File

@@ -20,8 +20,8 @@ import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.JobInstance;
@@ -59,7 +59,7 @@ public class EventListenerTests {
private EventEmittingChunkListener eventEmittingChunkListener;
@Before
@BeforeEach
public void beforeTests() {
this.queueChannel = new QueueChannel(1);
this.eventEmittingSkipListener = new EventEmittingSkipListener(this.queueChannel);

View File

@@ -23,8 +23,8 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.batch.core.BatchStatus;
import org.springframework.batch.core.JobExecution;
@@ -75,7 +75,7 @@ public class JobExecutionEventTests {
private JobInstance jobInstance;
@Before
@BeforeEach
public void setup() {
this.jobInstance = new JobInstance(JOB_INSTANCE_ID, JOB_NAME);
this.jobParameters = new JobParameters();

View File

@@ -16,7 +16,7 @@
package org.springframework.cloud.task.batch.listener;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.cloud.task.batch.listener.support.JobInstanceEvent;

View File

@@ -18,7 +18,7 @@ package org.springframework.cloud.task.batch.listener;
import java.util.Date;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.batch.core.JobParameter;
import org.springframework.cloud.task.batch.listener.support.JobParameterEvent;
@@ -73,16 +73,6 @@ public class JobParameterEventTests {
assertTrue(jobParameterEvent.equals(anotherJobParameterEvent));
}
@Test(expected = NullPointerException.class)
public void testInvalidHashCode() {
JobParameterEvent jobParameterEvent = new JobParameterEvent();
assertThat(jobParameterEvent.hashCode()).isNull();
final String EXPECTED_VALUE = "FOO";
JobParameter jobParameter = new JobParameter(EXPECTED_VALUE, true);
jobParameterEvent = new JobParameterEvent(jobParameter);
assertThat(jobParameterEvent.hashCode()).isNotNull();
}
@Test
public void testValidHashCode() {
final String EXPECTED_VALUE = "FOO";

View File

@@ -21,7 +21,7 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.batch.core.JobParameter;
import org.springframework.cloud.task.batch.listener.support.JobParametersEvent;

View File

@@ -18,7 +18,7 @@ package org.springframework.cloud.task.batch.listener;
import java.util.Date;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.batch.core.BatchStatus;
import org.springframework.batch.core.JobExecution;

View File

@@ -16,9 +16,9 @@
package org.springframework.cloud.task.batch.listener;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.batch.core.ChunkListener;
import org.springframework.batch.core.ItemProcessListener;
@@ -38,7 +38,7 @@ import org.springframework.cloud.task.batch.listener.support.TaskBatchEventListe
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.GenericApplicationContext;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.when;
@@ -46,7 +46,7 @@ import static org.mockito.Mockito.when;
/**
* @author Glenn Renfro
*/
@RunWith(SpringRunner.class)
@ExtendWith(SpringExtension.class)
@SpringBootTest
public class TaskBatchEventListenerBeanPostProcessorTests {
@@ -80,7 +80,7 @@ public class TaskBatchEventListenerBeanPostProcessorTests {
@Autowired
private GenericApplicationContext context;
@Before
@BeforeEach
public void setupMock() {
when(this.taskletStep.getTasklet()).thenReturn(
new ChunkOrientedTasklet(this.chunkProvider, this.chunkProcessor));

View File

@@ -16,8 +16,8 @@
package org.springframework.cloud.task.launcher;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
@@ -27,7 +27,7 @@ import org.springframework.cloud.deployer.spi.task.TaskLauncher;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import static org.assertj.core.api.Assertions.assertThat;
@@ -36,7 +36,7 @@ import static org.assertj.core.api.Assertions.assertThat;
*
* @author Glenn Renfro
*/
@RunWith(SpringRunner.class)
@ExtendWith(SpringExtension.class)
@SpringBootTest(classes = {
TaskLaunchConfigurationExistingTests.TestTaskDeployerConfiguration.class })
public class TaskLaunchConfigurationExistingTests {

View File

@@ -22,7 +22,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -22,9 +22,9 @@ import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
@@ -34,11 +34,11 @@ import org.springframework.cloud.task.launcher.app.TaskLauncherSinkApplication;
import org.springframework.cloud.task.launcher.configuration.TaskConfiguration;
import org.springframework.context.ApplicationContext;
import org.springframework.messaging.support.GenericMessage;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import static org.assertj.core.api.Assertions.assertThat;
@RunWith(SpringRunner.class)
@ExtendWith(SpringExtension.class)
@SpringBootTest(classes = { TaskLauncherSinkApplication.class, TaskConfiguration.class })
public class TaskLauncherSinkTests {
@@ -66,7 +66,7 @@ public class TaskLauncherSinkTests {
@Autowired
private Sink sink;
@Before
@BeforeEach
public void setup() {
this.properties = new HashMap<>();
this.properties.put("server.port", "0");

View File

@@ -16,7 +16,7 @@
package org.springframework.cloud.task.listener;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;