Convert XmlValidationModeDetectorTests to JUnit Jupiter and AssertJ
See gh-23605
This commit is contained in:
@@ -18,9 +18,10 @@ package org.springframework.util.xml;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.ValueSource;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.springframework.util.xml.XmlValidationModeDetector.VALIDATION_DTD;
|
||||
|
||||
/**
|
||||
@@ -29,34 +30,17 @@ import static org.springframework.util.xml.XmlValidationModeDetector.VALIDATION_
|
||||
* @author Sam Brannen
|
||||
* @since 5.1.10
|
||||
*/
|
||||
public class XmlValidationModeDetectorTests {
|
||||
class XmlValidationModeDetectorTests {
|
||||
|
||||
private final XmlValidationModeDetector xmlValidationModeDetector = new XmlValidationModeDetector();
|
||||
|
||||
|
||||
@Test
|
||||
public void dtdWithTrailingComment() throws Exception {
|
||||
dtdDetection("dtdWithTrailingComment.xml");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void dtdWithLeadingComment() throws Exception {
|
||||
dtdDetection("dtdWithLeadingComment.xml");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void dtdWithCommentOnNextLine() throws Exception {
|
||||
dtdDetection("dtdWithCommentOnNextLine.xml");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void dtdWithMultipleComments() throws Exception {
|
||||
dtdDetection("dtdWithMultipleComments.xml");
|
||||
}
|
||||
|
||||
private void dtdDetection(String fileName) throws Exception {
|
||||
@ParameterizedTest
|
||||
@ValueSource(strings = { "dtdWithTrailingComment.xml", "dtdWithLeadingComment.xml", "dtdWithCommentOnNextLine.xml",
|
||||
"dtdWithMultipleComments.xml" })
|
||||
void dtdDetection(String fileName) throws Exception {
|
||||
InputStream inputStream = getClass().getResourceAsStream(fileName);
|
||||
assertEquals(VALIDATION_DTD, xmlValidationModeDetector.detectValidationMode(inputStream));
|
||||
assertThat(xmlValidationModeDetector.detectValidationMode(inputStream)).isEqualTo(VALIDATION_DTD);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user