Removal of redundant JdkVersion checks in the test suite
Issue: SPR-13312
This commit is contained in:
parent
6e1567b4b0
commit
e0f012f32d
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2015 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.
|
||||
|
|
@ -25,7 +25,6 @@ import java.math.BigDecimal;
|
|||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.core.JdkVersion;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.equalTo;
|
||||
|
|
@ -138,7 +137,7 @@ public class ExtendedBeanInfoTests {
|
|||
|
||||
assertThat(hasReadMethodForProperty(bi, "foo"), is(true));
|
||||
assertThat(hasWriteMethodForProperty(bi, "foo"), is(false));
|
||||
assertThat(hasIndexedWriteMethodForProperty(bi, "foo"), is(trueUntilJdk17()));
|
||||
assertThat(hasIndexedWriteMethodForProperty(bi, "foo"), is(false));
|
||||
|
||||
BeanInfo ebi = new ExtendedBeanInfo(bi);
|
||||
|
||||
|
|
@ -484,7 +483,7 @@ public class ExtendedBeanInfoTests {
|
|||
|
||||
assertThat(hasIndexedReadMethodForProperty(bi, "foos"), is(true));
|
||||
// interesting! standard Inspector picks up non-void return types on indexed write methods by default
|
||||
assertThat(hasIndexedWriteMethodForProperty(bi, "foos"), is(trueUntilJdk17()));
|
||||
assertThat(hasIndexedWriteMethodForProperty(bi, "foos"), is(false));
|
||||
|
||||
BeanInfo ebi = new ExtendedBeanInfo(Introspector.getBeanInfo(C.class));
|
||||
|
||||
|
|
@ -509,13 +508,13 @@ public class ExtendedBeanInfoTests {
|
|||
assertThat(hasIndexedReadMethodForProperty(bi, "foos"), is(true));
|
||||
assertThat(hasWriteMethodForProperty(bi, "foos"), is(false));
|
||||
// again as above, standard Inspector picks up non-void return types on indexed write methods by default
|
||||
assertThat(hasIndexedWriteMethodForProperty(bi, "foos"), is(trueUntilJdk17()));
|
||||
assertThat(hasIndexedWriteMethodForProperty(bi, "foos"), is(false));
|
||||
|
||||
BeanInfo ebi = new ExtendedBeanInfo(Introspector.getBeanInfo(C.class));
|
||||
|
||||
assertThat(hasIndexedReadMethodForProperty(bi, "foos"), is(true));
|
||||
assertThat(hasWriteMethodForProperty(bi, "foos"), is(false));
|
||||
assertThat(hasIndexedWriteMethodForProperty(bi, "foos"), is(trueUntilJdk17()));
|
||||
assertThat(hasIndexedWriteMethodForProperty(bi, "foos"), is(false));
|
||||
|
||||
assertThat(hasIndexedReadMethodForProperty(ebi, "foos"), is(true));
|
||||
assertThat(hasWriteMethodForProperty(ebi, "foos"), is(true));
|
||||
|
|
@ -719,19 +718,19 @@ public class ExtendedBeanInfoTests {
|
|||
assertThat(hasReadMethodForProperty(bi, "dateFormat"), is(false));
|
||||
assertThat(hasWriteMethodForProperty(bi, "dateFormat"), is(false));
|
||||
assertThat(hasIndexedReadMethodForProperty(bi, "dateFormat"), is(false));
|
||||
assertThat(hasIndexedWriteMethodForProperty(bi, "dateFormat"), is(trueUntilJdk17()));
|
||||
assertThat(hasIndexedWriteMethodForProperty(bi, "dateFormat"), is(false));
|
||||
|
||||
BeanInfo ebi = new ExtendedBeanInfo(bi);
|
||||
|
||||
assertThat(hasReadMethodForProperty(bi, "dateFormat"), is(false));
|
||||
assertThat(hasWriteMethodForProperty(bi, "dateFormat"), is(false));
|
||||
assertThat(hasIndexedReadMethodForProperty(bi, "dateFormat"), is(false));
|
||||
assertThat(hasIndexedWriteMethodForProperty(bi, "dateFormat"), is(trueUntilJdk17()));
|
||||
assertThat(hasIndexedWriteMethodForProperty(bi, "dateFormat"), is(false));
|
||||
|
||||
assertThat(hasReadMethodForProperty(ebi, "dateFormat"), is(false));
|
||||
assertThat(hasWriteMethodForProperty(ebi, "dateFormat"), is(true));
|
||||
assertThat(hasIndexedReadMethodForProperty(ebi, "dateFormat"), is(false));
|
||||
assertThat(hasIndexedWriteMethodForProperty(ebi, "dateFormat"), is(trueUntilJdk17()));
|
||||
assertThat(hasIndexedWriteMethodForProperty(ebi, "dateFormat"), is(false));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -928,10 +927,6 @@ public class ExtendedBeanInfoTests {
|
|||
return false;
|
||||
}
|
||||
|
||||
private boolean trueUntilJdk17() {
|
||||
return JdkVersion.getMajorJavaVersion() < JdkVersion.JAVA_17;
|
||||
}
|
||||
|
||||
|
||||
interface Spr9453<T> {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2007 the original author or authors.
|
||||
* Copyright 2002-2015 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.
|
||||
|
|
@ -24,7 +24,6 @@ import org.junit.Test;
|
|||
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.beans.factory.support.RootBeanDefinition;
|
||||
import org.springframework.core.JdkVersion;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
|
|
@ -36,8 +35,7 @@ public class ServiceLoaderTests {
|
|||
|
||||
@Test
|
||||
public void testServiceLoaderFactoryBean() {
|
||||
if (JdkVersion.getMajorJavaVersion() < JdkVersion.JAVA_16 ||
|
||||
!ServiceLoader.load(DocumentBuilderFactory.class).iterator().hasNext()){
|
||||
if (!ServiceLoader.load(DocumentBuilderFactory.class).iterator().hasNext()){
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -51,8 +49,7 @@ public class ServiceLoaderTests {
|
|||
|
||||
@Test
|
||||
public void testServiceFactoryBean() {
|
||||
if (JdkVersion.getMajorJavaVersion() < JdkVersion.JAVA_16 ||
|
||||
!ServiceLoader.load(DocumentBuilderFactory.class).iterator().hasNext()){
|
||||
if (!ServiceLoader.load(DocumentBuilderFactory.class).iterator().hasNext()){
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -65,8 +62,7 @@ public class ServiceLoaderTests {
|
|||
|
||||
@Test
|
||||
public void testServiceListFactoryBean() {
|
||||
if (JdkVersion.getMajorJavaVersion() < JdkVersion.JAVA_16 ||
|
||||
!ServiceLoader.load(DocumentBuilderFactory.class).iterator().hasNext()){
|
||||
if (!ServiceLoader.load(DocumentBuilderFactory.class).iterator().hasNext()){
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2015 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.
|
||||
|
|
@ -20,20 +20,22 @@ import java.beans.IntrospectionException;
|
|||
import java.beans.PropertyDescriptor;
|
||||
import java.beans.SimpleBeanInfo;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.beans.BeanWrapper;
|
||||
import org.springframework.beans.BeanWrapperImpl;
|
||||
import org.springframework.beans.FatalBeanException;
|
||||
import org.springframework.core.JdkVersion;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* @author Juergen Hoeller
|
||||
* @since 06.03.2006
|
||||
*/
|
||||
public class BeanInfoTests extends TestCase {
|
||||
public class BeanInfoTests {
|
||||
|
||||
@Test
|
||||
public void testComplexObject() {
|
||||
ValueBean bean = new ValueBean();
|
||||
BeanWrapper bw = new BeanWrapperImpl(bean);
|
||||
|
|
@ -99,9 +101,7 @@ public class BeanInfoTests extends TestCase {
|
|||
|
||||
@Override
|
||||
public void setAsText(String text) throws IllegalArgumentException {
|
||||
if (JdkVersion.getMajorJavaVersion() >= JdkVersion.JAVA_15) {
|
||||
Assert.isTrue(this.target instanceof ValueBean, "Target must be available on JDK 1.5+");
|
||||
}
|
||||
Assert.isTrue(this.target instanceof ValueBean, "Target must be available");
|
||||
super.setAsText(text);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2015 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
|
||||
|
|
@ -18,35 +18,32 @@ package org.springframework.jmx.export.annotation;
|
|||
|
||||
import javax.management.MXBean;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.core.JdkVersion;
|
||||
import org.springframework.jmx.support.JmxUtils;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* @author Juergen Hoeller
|
||||
*/
|
||||
public class JmxUtilsAnnotationTests extends TestCase {
|
||||
public class JmxUtilsAnnotationTests {
|
||||
|
||||
@Test
|
||||
public void testNotMXBean() throws Exception {
|
||||
if (JdkVersion.getMajorJavaVersion() < JdkVersion.JAVA_16) {
|
||||
return;
|
||||
}
|
||||
FooNotX foo = new FooNotX();
|
||||
assertFalse("MXBean annotation not detected correctly", JmxUtils.isMBean(foo.getClass()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAnnotatedMXBean() throws Exception {
|
||||
if (JdkVersion.getMajorJavaVersion() < JdkVersion.JAVA_16) {
|
||||
return;
|
||||
}
|
||||
FooX foo = new FooX();
|
||||
assertTrue("MXBean annotation not detected correctly", JmxUtils.isMBean(foo.getClass()));
|
||||
}
|
||||
|
||||
|
||||
@MXBean(false)
|
||||
public static interface FooNotMXBean {
|
||||
public interface FooNotMXBean {
|
||||
|
||||
String getName();
|
||||
}
|
||||
|
|
@ -62,7 +59,7 @@ public class JmxUtilsAnnotationTests extends TestCase {
|
|||
|
||||
|
||||
@MXBean(true)
|
||||
public static interface FooIfc {
|
||||
public interface FooIfc {
|
||||
|
||||
String getName();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2015 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
|
||||
|
|
@ -25,50 +25,58 @@ import javax.management.NotCompliantMBeanException;
|
|||
import javax.management.ObjectName;
|
||||
import javax.management.StandardMBean;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.beans.BeanWrapperImpl;
|
||||
import org.springframework.core.JdkVersion;
|
||||
import org.springframework.jmx.IJmxTestBean;
|
||||
import org.springframework.jmx.JmxTestBean;
|
||||
import org.springframework.jmx.export.TestDynamicMBean;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* @author Rob Harrop
|
||||
* @author Juergen Hoeller
|
||||
*/
|
||||
public class JmxUtilsTests extends TestCase {
|
||||
public class JmxUtilsTests {
|
||||
|
||||
@Test
|
||||
public void testIsMBeanWithDynamicMBean() throws Exception {
|
||||
DynamicMBean mbean = new TestDynamicMBean();
|
||||
assertTrue("Dynamic MBean not detected correctly", JmxUtils.isMBean(mbean.getClass()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsMBeanWithStandardMBeanWrapper() throws Exception {
|
||||
StandardMBean mbean = new StandardMBean(new JmxTestBean(), IJmxTestBean.class);
|
||||
assertTrue("Standard MBean not detected correctly", JmxUtils.isMBean(mbean.getClass()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsMBeanWithStandardMBeanInherited() throws Exception {
|
||||
StandardMBean mbean = new StandardMBeanImpl();
|
||||
assertTrue("Standard MBean not detected correctly", JmxUtils.isMBean(mbean.getClass()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNotAnMBean() throws Exception {
|
||||
assertFalse("Object incorrectly identified as an MBean", JmxUtils.isMBean(Object.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimpleMBean() throws Exception {
|
||||
Foo foo = new Foo();
|
||||
assertTrue("Simple MBean not detected correctly", JmxUtils.isMBean(foo.getClass()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimpleMXBean() throws Exception {
|
||||
FooX foo = new FooX();
|
||||
assertTrue("Simple MXBean not detected correctly", JmxUtils.isMBean(foo.getClass()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimpleMBeanThroughInheritance() throws Exception {
|
||||
Bar bar = new Bar();
|
||||
Abc abc = new Abc();
|
||||
|
|
@ -78,18 +86,21 @@ public class JmxUtilsTests extends TestCase {
|
|||
JmxUtils.isMBean(abc.getClass()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetAttributeNameWithStrictCasing() {
|
||||
PropertyDescriptor pd = new BeanWrapperImpl(AttributeTestBean.class).getPropertyDescriptor("name");
|
||||
String attributeName = JmxUtils.getAttributeName(pd, true);
|
||||
assertEquals("Incorrect casing on attribute name", "Name", attributeName);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetAttributeNameWithoutStrictCasing() {
|
||||
PropertyDescriptor pd = new BeanWrapperImpl(AttributeTestBean.class).getPropertyDescriptor("name");
|
||||
String attributeName = JmxUtils.getAttributeName(pd, false);
|
||||
assertEquals("Incorrect casing on attribute name", "name", attributeName);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAppendIdentityToObjectName() throws MalformedObjectNameException {
|
||||
ObjectName objectName = ObjectNameManager.getInstance("spring:type=Test");
|
||||
Object managedResource = new Object();
|
||||
|
|
@ -102,11 +113,8 @@ public class JmxUtilsTests extends TestCase {
|
|||
assertEquals("Identity key is incorrect", ObjectUtils.getIdentityHexString(managedResource), uniqueName.getKeyProperty(JmxUtils.IDENTITY_OBJECT_NAME_KEY));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLocatePlatformMBeanServer() {
|
||||
if(JdkVersion.getMajorJavaVersion() < JdkVersion.JAVA_15) {
|
||||
return;
|
||||
}
|
||||
|
||||
MBeanServer server = null;
|
||||
try {
|
||||
server = JmxUtils.locateMBeanServer();
|
||||
|
|
@ -118,6 +126,7 @@ public class JmxUtilsTests extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsMBean() {
|
||||
// Correctly returns true for a class
|
||||
assertTrue(JmxUtils.isMBean(JmxClass.class));
|
||||
|
|
|
|||
|
|
@ -19,13 +19,13 @@ package org.springframework.core.io.support;
|
|||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
|
|
@ -42,19 +42,17 @@ public class PathMatchingResourcePatternResolverTests {
|
|||
|
||||
private static final String[] CLASSES_IN_CORE_IO_SUPPORT =
|
||||
new String[] {"EncodedResource.class", "LocalizedResourceHelper.class",
|
||||
"PathMatchingResourcePatternResolver.class",
|
||||
"PropertiesLoaderSupport.class", "PropertiesLoaderUtils.class",
|
||||
"ResourceArrayPropertyEditor.class",
|
||||
"ResourcePatternResolver.class", "ResourcePatternUtils.class"};
|
||||
"PathMatchingResourcePatternResolver.class", "PropertiesLoaderSupport.class",
|
||||
"PropertiesLoaderUtils.class", "ResourceArrayPropertyEditor.class",
|
||||
"ResourcePatternResolver.class", "ResourcePatternUtils.class"};
|
||||
|
||||
private static final String[] TEST_CLASSES_IN_CORE_IO_SUPPORT =
|
||||
new String[] {"PathMatchingResourcePatternResolverTests.class"};
|
||||
|
||||
private static final String[] CLASSES_IN_COMMONSLOGGING =
|
||||
new String[] {"Log.class", "LogConfigurationException.class", "LogFactory.class",
|
||||
"LogFactory$1.class", "LogFactory$2.class", "LogFactory$3.class",
|
||||
"LogFactory$4.class", "LogFactory$5.class", "LogFactory$6.class",
|
||||
"LogSource.class"};
|
||||
"LogFactory$1.class", "LogFactory$2.class", "LogFactory$3.class", "LogFactory$4.class",
|
||||
"LogFactory$5.class", "LogFactory$6.class", "LogSource.class"};
|
||||
|
||||
private PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
|
||||
|
||||
|
|
@ -75,19 +73,17 @@ public class PathMatchingResourcePatternResolverTests {
|
|||
Resource[] resources =
|
||||
resolver.getResources("org/springframework/core/io/support/PathMatchingResourcePatternResolverTests.class");
|
||||
assertEquals(1, resources.length);
|
||||
assertProtocolAndFilename(resources[0], "file", "PathMatchingResourcePatternResolverTests.class");
|
||||
assertProtocolAndFilenames(resources, "file", "PathMatchingResourcePatternResolverTests.class");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSingleResourceInJar() throws IOException {
|
||||
Resource[] resources = resolver.getResources("java/net/URL.class");
|
||||
assertEquals(1, resources.length);
|
||||
@SuppressWarnings("deprecation")
|
||||
String expectedProtocol = (org.springframework.core.JdkVersion.getMajorJavaVersion() < org.springframework.core.JdkVersion.JAVA_19 ? "jar" : "jrt");
|
||||
assertProtocolAndFilename(resources[0], expectedProtocol, "URL.class");
|
||||
assertProtocolAndFilenames(resources, "jar", "URL.class");
|
||||
}
|
||||
|
||||
@Ignore // passes under eclipse, fails under ant
|
||||
@Ignore // passes under Eclipse, fails under Ant
|
||||
@Test
|
||||
public void testClasspathStarWithPatternOnFileSystem() throws IOException {
|
||||
Resource[] resources = resolver.getResources("classpath*:org/springframework/core/io/sup*/*.class");
|
||||
|
|
@ -100,7 +96,8 @@ public class PathMatchingResourcePatternResolverTests {
|
|||
}
|
||||
}
|
||||
resources = noCloverResources.toArray(new Resource[noCloverResources.size()]);
|
||||
assertProtocolAndFilenames(resources, "file", CLASSES_IN_CORE_IO_SUPPORT, TEST_CLASSES_IN_CORE_IO_SUPPORT);
|
||||
assertProtocolAndFilenames(resources, "file",
|
||||
StringUtils.concatenateStringArrays(CLASSES_IN_CORE_IO_SUPPORT, TEST_CLASSES_IN_CORE_IO_SUPPORT));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -128,19 +125,7 @@ public class PathMatchingResourcePatternResolverTests {
|
|||
}
|
||||
|
||||
|
||||
private void assertProtocolAndFilename(Resource resource, String urlProtocol, String fileName) throws IOException {
|
||||
assertProtocolAndFilenames(new Resource[] {resource}, urlProtocol, new String[] {fileName});
|
||||
}
|
||||
|
||||
private void assertProtocolAndFilenames(
|
||||
Resource[] resources, String urlProtocol, String[] fileNames1, String[] fileNames2) throws IOException {
|
||||
|
||||
List<String> fileNames = new ArrayList<String>(Arrays.asList(fileNames1));
|
||||
fileNames.addAll(Arrays.asList(fileNames2));
|
||||
assertProtocolAndFilenames(resources, urlProtocol, fileNames.toArray(new String[fileNames.size()]));
|
||||
}
|
||||
|
||||
private void assertProtocolAndFilenames(Resource[] resources, String urlProtocol, String[] fileNames)
|
||||
private void assertProtocolAndFilenames(Resource[] resources, String protocol, String... filenames)
|
||||
throws IOException {
|
||||
|
||||
// Uncomment the following if you encounter problems with matching against the file system
|
||||
|
|
@ -161,20 +146,22 @@ public class PathMatchingResourcePatternResolverTests {
|
|||
// System.out.println(resources[i]);
|
||||
// }
|
||||
|
||||
assertEquals("Correct number of files found", fileNames.length, resources.length);
|
||||
assertEquals("Correct number of files found", filenames.length, resources.length);
|
||||
for (Resource resource : resources) {
|
||||
assertEquals(urlProtocol, resource.getURL().getProtocol());
|
||||
assertFilenameIn(resource, fileNames);
|
||||
String actualProtocol = resource.getURL().getProtocol();
|
||||
// resources from rt.jar get retrieved as jrt images on JDK 9, so let's simply accept that as a match too
|
||||
assertTrue(actualProtocol.equals(protocol) || ("jar".equals(protocol) && "jrt".equals(actualProtocol)));
|
||||
assertFilenameIn(resource, filenames);
|
||||
}
|
||||
}
|
||||
|
||||
private void assertFilenameIn(Resource resource, String[] fileNames) {
|
||||
for (String fileName : fileNames) {
|
||||
if (resource.getFilename().endsWith(fileName)) {
|
||||
private void assertFilenameIn(Resource resource, String... filenames) {
|
||||
for (String filename : filenames) {
|
||||
if (resource.getFilename().endsWith(filename)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
fail("resource [" + resource + "] does not have a filename that matches and of the names in 'fileNames'");
|
||||
fail(resource + " does not have a filename that matches any of the specified names");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2015 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.
|
||||
|
|
@ -20,7 +20,6 @@ import java.sql.SQLException;
|
|||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.springframework.core.JdkVersion;
|
||||
import org.springframework.dao.ConcurrencyFailureException;
|
||||
import org.springframework.dao.DataAccessResourceFailureException;
|
||||
import org.springframework.dao.DataIntegrityViolationException;
|
||||
|
|
@ -39,15 +38,11 @@ public class SQLExceptionSubclassTranslatorTests extends TestCase {
|
|||
private static SQLErrorCodes ERROR_CODES = new SQLErrorCodes();
|
||||
|
||||
static {
|
||||
ERROR_CODES.setBadSqlGrammarCodes(new String[] { "1" });
|
||||
ERROR_CODES.setBadSqlGrammarCodes("1");
|
||||
}
|
||||
|
||||
|
||||
public void testErrorCodeTranslation() {
|
||||
if (JdkVersion.getMajorJavaVersion() < JdkVersion.JAVA_16) {
|
||||
return;
|
||||
}
|
||||
|
||||
SQLExceptionTranslator sext = new SQLErrorCodeSQLExceptionTranslator(ERROR_CODES);
|
||||
|
||||
SQLException dataIntegrityViolationEx = SQLExceptionSubclassFactory.newSQLDataException("", "", 0);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2015 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.
|
||||
|
|
@ -36,7 +36,6 @@ import org.junit.Test;
|
|||
import org.xml.sax.SAXException;
|
||||
|
||||
import org.springframework.context.support.StaticApplicationContext;
|
||||
import org.springframework.core.JdkVersion;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.mock.web.test.MockHttpServletRequest;
|
||||
|
|
@ -184,11 +183,6 @@ public class XsltViewTests {
|
|||
}
|
||||
|
||||
private void assertHtmlOutput(String output) throws Exception {
|
||||
if (JdkVersion.getMajorJavaVersion() < JdkVersion.JAVA_15) {
|
||||
// TODO: find out why the SAXReader.read call fails on JDK 1.4 and 1.3
|
||||
return;
|
||||
}
|
||||
|
||||
SAXReader reader = new SAXReader();
|
||||
Document document = reader.read(new StringReader(output));
|
||||
List nodes = document.getRootElement().selectNodes("/html/body/table/tr");
|
||||
|
|
|
|||
Loading…
Reference in New Issue