Name test classes consistently

Closes gh-1468
This commit is contained in:
Andy Wilkinson
2025-02-21 11:45:27 +00:00
committed by Stéphane Nicoll
parent da47205e58
commit fb4ab827c5
109 changed files with 198 additions and 199 deletions

View File

@@ -39,7 +39,7 @@ import org.springframework.xml.transform.ResourceSource;
import static org.assertj.core.api.Assertions.assertThat;
public abstract class AbstractValidatorFactoryTestCase {
public abstract class AbstractValidatorFactoryTest {
private XmlValidator validator;
@@ -51,10 +51,10 @@ public abstract class AbstractValidatorFactoryTestCase {
public void setUp() throws Exception {
Resource[] schemaResource = new Resource[] {
new ClassPathResource("schema.xsd", AbstractValidatorFactoryTestCase.class) };
new ClassPathResource("schema.xsd", AbstractValidatorFactoryTest.class) };
validator = createValidator(schemaResource, XmlValidatorFactory.SCHEMA_W3C_XML);
validInputStream = AbstractValidatorFactoryTestCase.class.getResourceAsStream("validDocument.xml");
invalidInputStream = AbstractValidatorFactoryTestCase.class.getResourceAsStream("invalidDocument.xml");
validInputStream = AbstractValidatorFactoryTest.class.getResourceAsStream("validDocument.xml");
invalidInputStream = AbstractValidatorFactoryTest.class.getResourceAsStream("invalidDocument.xml");
}
@AfterEach
@@ -78,7 +78,7 @@ public abstract class AbstractValidatorFactoryTestCase {
public void testValidateTwice() throws Exception {
validator.validate(new StreamSource(validInputStream));
validInputStream = AbstractValidatorFactoryTestCase.class.getResourceAsStream("validDocument.xml");
validInputStream = AbstractValidatorFactoryTest.class.getResourceAsStream("validDocument.xml");
validator.validate(new StreamSource(validInputStream));
}
@@ -133,19 +133,19 @@ public abstract class AbstractValidatorFactoryTestCase {
public void testMultipleSchemasValidMessage() throws Exception {
Resource[] schemaResources = new Resource[] {
new ClassPathResource("multipleSchemas1.xsd", AbstractValidatorFactoryTestCase.class),
new ClassPathResource("multipleSchemas2.xsd", AbstractValidatorFactoryTestCase.class) };
new ClassPathResource("multipleSchemas1.xsd", AbstractValidatorFactoryTest.class),
new ClassPathResource("multipleSchemas2.xsd", AbstractValidatorFactoryTest.class) };
validator = createValidator(schemaResources, XmlValidatorFactory.SCHEMA_W3C_XML);
Source document = new ResourceSource(
new ClassPathResource("multipleSchemas1.xml", AbstractValidatorFactoryTestCase.class));
new ClassPathResource("multipleSchemas1.xml", AbstractValidatorFactoryTest.class));
SAXParseException[] errors = validator.validate(document);
assertThat(errors).isEmpty();
validator = createValidator(schemaResources, XmlValidatorFactory.SCHEMA_W3C_XML);
document = new ResourceSource(
new ClassPathResource("multipleSchemas2.xml", AbstractValidatorFactoryTestCase.class));
new ClassPathResource("multipleSchemas2.xml", AbstractValidatorFactoryTest.class));
errors = validator.validate(document);
assertThat(errors).isEmpty();

View File

@@ -20,7 +20,7 @@ import java.io.IOException;
import org.springframework.core.io.Resource;
public class Jaxp13ValidatorFactoryTest extends AbstractValidatorFactoryTestCase {
public class Jaxp13ValidatorFactoryTest extends AbstractValidatorFactoryTest {
@Override
protected XmlValidator createValidator(Resource[] schemaResources, String schemaLanguage) throws IOException {

View File

@@ -20,7 +20,7 @@ import java.io.IOException;
import org.springframework.core.io.Resource;
public class Jaxp15ValidatorFactoryTest extends AbstractValidatorFactoryTestCase {
public class Jaxp15ValidatorFactoryTest extends AbstractValidatorFactoryTest {
@Override
protected XmlValidator createValidator(Resource[] schemaResources, String schemaLanguage) throws IOException {

View File

@@ -36,7 +36,7 @@ public class XmlValidatorFactoryTest {
@Test
public void testCreateValidator() throws Exception {
Resource resource = new ClassPathResource("schema.xsd", AbstractValidatorFactoryTestCase.class);
Resource resource = new ClassPathResource("schema.xsd", AbstractValidatorFactoryTest.class);
XmlValidator validator = XmlValidatorFactory.createValidator(resource, XmlValidatorFactory.SCHEMA_W3C_XML);
assertThat(validator).isNotNull();
@@ -53,7 +53,7 @@ public class XmlValidatorFactoryTest {
public void testInvalidSchemaLanguage() {
assertThatIllegalArgumentException().isThrownBy(() -> XmlValidatorFactory
.createValidator(new ClassPathResource("schema.xsd", AbstractValidatorFactoryTestCase.class), "bla"));
.createValidator(new ClassPathResource("schema.xsd", AbstractValidatorFactoryTest.class), "bla"));
}
private static class NonExistentResource extends AbstractResource {

View File

@@ -37,7 +37,7 @@ import org.springframework.xml.DocumentBuilderFactoryUtils;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
public abstract class AbstractXPathExpressionFactoryTestCase {
public abstract class AbstractXPathExpressionFactoryTest {
private Document noNamespacesDocument;

View File

@@ -48,7 +48,7 @@ import org.springframework.xml.transform.ResourceSource;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
public abstract class AbstractXPathTemplateTestCase {
public abstract class AbstractXPathTemplateTest {
XPathOperations template;
@@ -59,9 +59,8 @@ public abstract class AbstractXPathTemplateTestCase {
@BeforeEach
public final void setUp() throws Exception {
template = createTemplate();
namespaces = new ResourceSource(new ClassPathResource("namespaces.xml", AbstractXPathTemplateTestCase.class));
nonamespaces = new ResourceSource(
new ClassPathResource("nonamespaces.xml", AbstractXPathTemplateTestCase.class));
namespaces = new ResourceSource(new ClassPathResource("namespaces.xml", AbstractXPathTemplateTest.class));
nonamespaces = new ResourceSource(new ClassPathResource("nonamespaces.xml", AbstractXPathTemplateTest.class));
}
protected abstract XPathOperations createTemplate() throws Exception;
@@ -156,8 +155,8 @@ public abstract class AbstractXPathTemplateTestCase {
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactoryUtils.newInstance();
documentBuilderFactory.setNamespaceAware(true);
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
Document document = documentBuilder.parse(SaxUtils
.createInputSource(new ClassPathResource("nonamespaces.xml", AbstractXPathTemplateTestCase.class)));
Document document = documentBuilder.parse(
SaxUtils.createInputSource(new ClassPathResource("nonamespaces.xml", AbstractXPathTemplateTest.class)));
String result = template.evaluateAsString("/root/child/text", new DOMSource(document));
@@ -167,7 +166,7 @@ public abstract class AbstractXPathTemplateTestCase {
@Test
public void testEvaluateSAXSource() throws Exception {
InputStream in = AbstractXPathTemplateTestCase.class.getResourceAsStream("nonamespaces.xml");
InputStream in = AbstractXPathTemplateTest.class.getResourceAsStream("nonamespaces.xml");
SAXSource source = new SAXSource(new InputSource(in));
String result = template.evaluateAsString("/root/child/text", source);
@@ -177,7 +176,7 @@ public abstract class AbstractXPathTemplateTestCase {
@Test
public void testEvaluateStaxSource() throws Exception {
InputStream in = AbstractXPathTemplateTestCase.class.getResourceAsStream("nonamespaces.xml");
InputStream in = AbstractXPathTemplateTest.class.getResourceAsStream("nonamespaces.xml");
XMLStreamReader streamReader = XMLInputFactory.newFactory().createXMLStreamReader(in);
StAXSource source = new StAXSource(streamReader);
String result = template.evaluateAsString("/root/child/text", source);
@@ -188,7 +187,7 @@ public abstract class AbstractXPathTemplateTestCase {
@Test
public void testEvaluateStreamSourceInputStream() throws IOException, SAXException, ParserConfigurationException {
InputStream in = AbstractXPathTemplateTestCase.class.getResourceAsStream("nonamespaces.xml");
InputStream in = AbstractXPathTemplateTest.class.getResourceAsStream("nonamespaces.xml");
StreamSource source = new StreamSource(in);
String result = template.evaluateAsString("/root/child/text", source);
@@ -198,7 +197,7 @@ public abstract class AbstractXPathTemplateTestCase {
@Test
public void testEvaluateStreamSourceSystemId() throws IOException, SAXException, ParserConfigurationException {
URL url = AbstractXPathTemplateTestCase.class.getResource("nonamespaces.xml");
URL url = AbstractXPathTemplateTest.class.getResource("nonamespaces.xml");
String result = template.evaluateAsString("/root/child/text", new StreamSource(url.toString()));
assertThat(result).isEqualTo("text");

View File

@@ -21,7 +21,7 @@ import java.util.Map;
import org.xml.sax.SAXException;
public class JaxenXPathExpressionFactoryTest extends AbstractXPathExpressionFactoryTestCase {
public class JaxenXPathExpressionFactoryTest extends AbstractXPathExpressionFactoryTest {
@Override
protected XPathExpression createXPathExpression(String expression) {

View File

@@ -19,7 +19,7 @@ package org.springframework.xml.xpath;
import java.util.HashMap;
import java.util.Map;
public class JaxenXPathTemplateTest extends AbstractXPathTemplateTestCase {
public class JaxenXPathTemplateTest extends AbstractXPathTemplateTest {
@Override
protected XPathOperations createTemplate() {

View File

@@ -18,7 +18,7 @@ package org.springframework.xml.xpath;
import java.util.Map;
public class Jaxp13XPathExpressionFactoryTest extends AbstractXPathExpressionFactoryTestCase {
public class Jaxp13XPathExpressionFactoryTest extends AbstractXPathExpressionFactoryTest {
@Override
protected XPathExpression createXPathExpression(String expression) {

View File

@@ -19,7 +19,7 @@ package org.springframework.xml.xpath;
import java.util.HashMap;
import java.util.Map;
public class Jaxp13XPathTemplateTest extends AbstractXPathTemplateTestCase {
public class Jaxp13XPathTemplateTest extends AbstractXPathTemplateTest {
@Override
protected XPathOperations createTemplate() {

View File

@@ -36,7 +36,7 @@ import org.springframework.xml.validation.XmlValidator;
import static org.assertj.core.api.Assertions.assertThat;
public abstract class AbstractXsdSchemaTestCase {
public abstract class AbstractXsdSchemaTest {
private DocumentBuilder documentBuilder;
@@ -55,12 +55,12 @@ public abstract class AbstractXsdSchemaTestCase {
@Test
public void testSingle() throws Exception {
Resource resource = new ClassPathResource("single.xsd", AbstractXsdSchemaTestCase.class);
Resource resource = new ClassPathResource("single.xsd", AbstractXsdSchemaTest.class);
XsdSchema single = createSchema(resource);
assertThat(single.getTargetNamespace()).isEqualTo("http://www.springframework.org/spring-ws/single/schema");
resource = new ClassPathResource("single.xsd", AbstractXsdSchemaTestCase.class);
resource = new ClassPathResource("single.xsd", AbstractXsdSchemaTest.class);
Document expected = documentBuilder.parse(SaxUtils.createInputSource(resource));
DOMResult domResult = new DOMResult();
transformer.transform(single.getSource(), domResult);
@@ -72,12 +72,12 @@ public abstract class AbstractXsdSchemaTestCase {
@Test
public void testIncludes() throws Exception {
Resource resource = new ClassPathResource("including.xsd", AbstractXsdSchemaTestCase.class);
Resource resource = new ClassPathResource("including.xsd", AbstractXsdSchemaTest.class);
XsdSchema including = createSchema(resource);
assertThat(including.getTargetNamespace()).isEqualTo("http://www.springframework.org/spring-ws/include/schema");
resource = new ClassPathResource("including.xsd", AbstractXsdSchemaTestCase.class);
resource = new ClassPathResource("including.xsd", AbstractXsdSchemaTest.class);
Document expected = documentBuilder.parse(SaxUtils.createInputSource(resource));
DOMResult domResult = new DOMResult();
transformer.transform(including.getSource(), domResult);
@@ -89,13 +89,13 @@ public abstract class AbstractXsdSchemaTestCase {
@Test
public void testImports() throws Exception {
Resource resource = new ClassPathResource("importing.xsd", AbstractXsdSchemaTestCase.class);
Resource resource = new ClassPathResource("importing.xsd", AbstractXsdSchemaTest.class);
XsdSchema importing = createSchema(resource);
assertThat(importing.getTargetNamespace())
.isEqualTo("http://www.springframework.org/spring-ws/importing/schema");
resource = new ClassPathResource("importing.xsd", AbstractXsdSchemaTestCase.class);
resource = new ClassPathResource("importing.xsd", AbstractXsdSchemaTest.class);
Document expected = documentBuilder.parse(SaxUtils.createInputSource(resource));
DOMResult domResult = new DOMResult();
transformer.transform(importing.getSource(), domResult);
@@ -107,12 +107,12 @@ public abstract class AbstractXsdSchemaTestCase {
@Test
public void testXmlNamespace() throws Exception {
Resource resource = new ClassPathResource("xmlNamespace.xsd", AbstractXsdSchemaTestCase.class);
Resource resource = new ClassPathResource("xmlNamespace.xsd", AbstractXsdSchemaTest.class);
XsdSchema importing = createSchema(resource);
assertThat(importing.getTargetNamespace()).isEqualTo("http://www.springframework.org/spring-ws/xmlNamespace");
resource = new ClassPathResource("xmlNamespace.xsd", AbstractXsdSchemaTestCase.class);
resource = new ClassPathResource("xmlNamespace.xsd", AbstractXsdSchemaTest.class);
Document expected = documentBuilder.parse(SaxUtils.createInputSource(resource));
DOMResult domResult = new DOMResult();
transformer.transform(importing.getSource(), domResult);
@@ -124,7 +124,7 @@ public abstract class AbstractXsdSchemaTestCase {
@Test
public void testCreateValidator() throws Exception {
Resource resource = new ClassPathResource("single.xsd", AbstractXsdSchemaTestCase.class);
Resource resource = new ClassPathResource("single.xsd", AbstractXsdSchemaTest.class);
XsdSchema single = createSchema(resource);
XmlValidator validator = single.createValidator();

View File

@@ -21,7 +21,7 @@ import static org.assertj.core.api.Assertions.*;
import org.junit.jupiter.api.Test;
import org.springframework.core.io.Resource;
public class SimpleXsdSchemaTest extends AbstractXsdSchemaTestCase {
public class SimpleXsdSchemaTest extends AbstractXsdSchemaTest {
@Override
protected XsdSchema createSchema(Resource resource) throws Exception {

View File

@@ -33,7 +33,7 @@ import org.springframework.xml.DocumentBuilderFactoryUtils;
import org.springframework.xml.sax.SaxUtils;
import org.springframework.xml.transform.TransformerFactoryUtils;
import org.springframework.xml.validation.XmlValidator;
import org.springframework.xml.xsd.AbstractXsdSchemaTestCase;
import org.springframework.xml.xsd.AbstractXsdSchemaTest;
import org.springframework.xml.xsd.XsdSchema;
import static org.assertj.core.api.Assertions.assertThat;
@@ -61,7 +61,7 @@ public class CommonsXsdSchemaCollectionTest {
@Test
public void testSingle() throws Exception {
Resource resource = new ClassPathResource("single.xsd", AbstractXsdSchemaTestCase.class);
Resource resource = new ClassPathResource("single.xsd", AbstractXsdSchemaTest.class);
collection.setXsds(resource);
collection.afterPropertiesSet();
@@ -71,7 +71,7 @@ public class CommonsXsdSchemaCollectionTest {
@Test
public void testInlineComplex() throws Exception {
Resource a = new ClassPathResource("A.xsd", AbstractXsdSchemaTestCase.class);
Resource a = new ClassPathResource("A.xsd", AbstractXsdSchemaTest.class);
collection.setXsds(a);
collection.setInline(true);
collection.afterPropertiesSet();
@@ -80,7 +80,7 @@ public class CommonsXsdSchemaCollectionTest {
assertThat(schemas).hasSize(2);
assertThat(schemas[0].getTargetNamespace()).isEqualTo("urn:1");
Resource abc = new ClassPathResource("ABC.xsd", AbstractXsdSchemaTestCase.class);
Resource abc = new ClassPathResource("ABC.xsd", AbstractXsdSchemaTest.class);
Document expected = documentBuilder.parse(SaxUtils.createInputSource(abc));
DOMResult domResult = new DOMResult();
transformer.transform(schemas[0].getSource(), domResult);
@@ -91,7 +91,7 @@ public class CommonsXsdSchemaCollectionTest {
.areIdentical();
assertThat(schemas[1].getTargetNamespace()).isEqualTo("urn:2");
Resource cd = new ClassPathResource("CD.xsd", AbstractXsdSchemaTestCase.class);
Resource cd = new ClassPathResource("CD.xsd", AbstractXsdSchemaTest.class);
expected = documentBuilder.parse(SaxUtils.createInputSource(cd));
domResult = new DOMResult();
transformer.transform(schemas[1].getSource(), domResult);
@@ -105,7 +105,7 @@ public class CommonsXsdSchemaCollectionTest {
@Test
public void testCircular() throws Exception {
Resource resource = new ClassPathResource("circular-1.xsd", AbstractXsdSchemaTestCase.class);
Resource resource = new ClassPathResource("circular-1.xsd", AbstractXsdSchemaTest.class);
collection.setXsds(resource);
collection.setInline(true);
collection.afterPropertiesSet();
@@ -117,7 +117,7 @@ public class CommonsXsdSchemaCollectionTest {
@Test
public void testXmlNamespace() throws Exception {
Resource resource = new ClassPathResource("xmlNamespace.xsd", AbstractXsdSchemaTestCase.class);
Resource resource = new ClassPathResource("xmlNamespace.xsd", AbstractXsdSchemaTest.class);
collection.setXsds(resource);
collection.setInline(true);
collection.afterPropertiesSet();
@@ -129,7 +129,7 @@ public class CommonsXsdSchemaCollectionTest {
@Test
public void testCreateValidator() throws Exception {
Resource a = new ClassPathResource("A.xsd", AbstractXsdSchemaTestCase.class);
Resource a = new ClassPathResource("A.xsd", AbstractXsdSchemaTest.class);
collection.setXsds(a);
collection.setInline(true);
collection.afterPropertiesSet();
@@ -142,7 +142,7 @@ public class CommonsXsdSchemaCollectionTest {
@Test
public void testInvalidSchema() throws Exception {
Resource invalid = new ClassPathResource("invalid.xsd", AbstractXsdSchemaTestCase.class);
Resource invalid = new ClassPathResource("invalid.xsd", AbstractXsdSchemaTest.class);
collection.setXsds(invalid);
assertThatExceptionOfType(CommonsXsdSchemaException.class).isThrownBy(() -> collection.afterPropertiesSet());

View File

@@ -27,12 +27,12 @@ import org.w3c.dom.Element;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.xml.sax.SaxUtils;
import org.springframework.xml.xsd.AbstractXsdSchemaTestCase;
import org.springframework.xml.xsd.AbstractXsdSchemaTest;
import org.springframework.xml.xsd.XsdSchema;
import static org.assertj.core.api.Assertions.assertThat;
public class CommonsXsdSchemaTest extends AbstractXsdSchemaTestCase {
public class CommonsXsdSchemaTest extends AbstractXsdSchemaTest {
@Override
protected XsdSchema createSchema(Resource resource) throws Exception {
@@ -46,7 +46,7 @@ public class CommonsXsdSchemaTest extends AbstractXsdSchemaTestCase {
@Test
public void testXmime() throws Exception {
Resource resource = new ClassPathResource("xmime.xsd", AbstractXsdSchemaTestCase.class);
Resource resource = new ClassPathResource("xmime.xsd", AbstractXsdSchemaTest.class);
XsdSchema schema = createSchema(resource);
String namespace = "urn:test";