/*
 * Copyright 2002-2019 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.springframework.util.xml;

import java.io.InputStream;

import org.junit.Test;

import static org.junit.Assert.assertEquals;
import static org.springframework.util.xml.XmlValidationModeDetector.VALIDATION_DTD;

/**
 * Unit tests for {@link XmlValidationModeDetector}.
 *
 * @author Sam Brannen
 * @since 5.1.10
 */
public 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 {
		InputStream inputStream = getClass().getResourceAsStream(fileName);
		assertEquals(VALIDATION_DTD, xmlValidationModeDetector.detectValidationMode(inputStream));
	}

}

@@ -701,20 +701,102 @@
 g.junit.
-Test
+jupiter.params.ParameterizedTest;%0Aimport org.junit.jupiter.params.provider.ValueSource
 ;%0A%0Aimpor
@@ -812,33 +812,46 @@
 org.
-junit
+assertj.core.api
 .Assert
+ions
 .assert
-Equals
+That
 ;%0Aim
@@ -1038,23 +1038,16 @@
 .10%0A */%0A
-public 
 class Xm
@@ -1188,430 +1188,145 @@
 %0A%0A%09@
-Test%0A%09public void dtdWithTrailingComment() throws Exception %7B%0A%09%09dtdDetection(%22dtdWithTrailingComment.xml%22);%0A%09%7D%0A%0A%09@Test%0A%09public void dtdWithLeadingComment() throws Exception %7B%0A%09%09dtdDetection(%22dtdWithLeadingComment.xml%22);%0A%09%7D%0A%0A%09@Test%0A%09public void dtdWithCommentOnNextLine() throws Exception %7B%0A%09%09dtdDetection(%22dtdWithCommentOnNextLine.xml%22);%0A%09%7D%0A%0A%09@Test%0A%09public void dtdWithMultipleComments() throws Exception %7B%0A%09%09dtdDetection(
+ParameterizedTest%0A%09@ValueSource(strings = %7B %22dtdWithTrailingComment.xml%22, %22dtdWithLeadingComment.xml%22, %22dtdWithCommentOnNextLine.xml%22,%0A%09%09
 %22dtd
@@ -1354,24 +1354,13 @@
 xml%22
-);%0A%09%7D%0A%0A%09private 
+ %7D)%0A%09
 void
@@ -1491,31 +1491,13 @@
 sert
-Equals(VALIDATION_DTD, 
+That(
 xmlV
@@ -1552,16 +1552,42 @@
 Stream))
+.isEqualTo(VALIDATION_DTD)
 ;%0A%09%7D%0A%0A%7D%0A

Convert XmlValidationModeDetectorTests to JUnit Jupiter and AssertJ