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

@@ -21,7 +21,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.batch.core.Job;
import org.springframework.batch.core.JobExecution;

View File

@@ -23,9 +23,9 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.batch.core.Job;
import org.springframework.batch.core.JobExecution;
@@ -62,12 +62,12 @@ public class FlatFileItemWriterAutoConfigurationTests {
private File outputFile;
@Before
@BeforeEach
public void setUp() throws Exception {
this.outputFile = File.createTempFile("flatfile-config-test-output", ".tmp");
}
@After
@AfterEach
public void tearDown() {
this.outputFile.delete();
}

View File

@@ -16,11 +16,12 @@
package org.springframework.cloud.task.batch.autoconfigure;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.batch.item.file.transform.Range;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
/**
* @author Michael Minella
@@ -54,18 +55,22 @@ public class RangeConverterTests {
assertThat(range.getMax()).isEqualTo(25);
}
@Test(expected = NumberFormatException.class)
@Test
public void testIllegalValue() {
RangeConverter converter = new RangeConverter();
converter.convert("invalid");
assertThatExceptionOfType(NumberFormatException.class).isThrownBy(() -> {
converter.convert("invalid");
});
}
@Test(expected = IllegalArgumentException.class)
@Test
public void testTooManyValues() {
RangeConverter converter = new RangeConverter();
converter.convert("1-2-3-4");
assertThatExceptionOfType(IllegalArgumentException.class).isThrownBy(() -> {
converter.convert("1-2-3-4");
});
}
}

View File

@@ -21,7 +21,7 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.batch.core.Job;
import org.springframework.batch.core.JobExecution;