Remove trailing whitespace in source files
find . -type f -name "*.java" -or -name "*.aj" | \
xargs perl -p -i -e "s/[ \t]*$//g" {} \;
Issue: SPR-10127
This commit is contained in:
committed by
Chris Beams
parent
44a474a014
commit
1762157ad1
@@ -25,7 +25,7 @@ package org.springframework.core;
|
||||
* @see org.springframework.core.Constants
|
||||
*/
|
||||
public class ConstantException extends IllegalArgumentException {
|
||||
|
||||
|
||||
/**
|
||||
* Thrown when an invalid constant name is requested.
|
||||
* @param className name of the class containing the constant definitions
|
||||
|
||||
@@ -207,7 +207,7 @@ public class Constants {
|
||||
* in accordance with the standard Java convention for constant
|
||||
* values (i.e. all uppercase). The supplied <code>namePrefix</code>
|
||||
* will be uppercased (in a locale-insensitive fashion) prior to
|
||||
* the main logic of this method kicking in.
|
||||
* the main logic of this method kicking in.
|
||||
* @param namePrefix prefix of the constant names to search (may be <code>null</code>)
|
||||
* @return the set of values
|
||||
*/
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2002-2005 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
|
||||
*
|
||||
*
|
||||
* http://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.
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2002-2005 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
|
||||
*
|
||||
*
|
||||
* http://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.
|
||||
@@ -27,9 +27,9 @@ package org.springframework.core;
|
||||
* @see org.springframework.context.MessageSource
|
||||
*/
|
||||
public interface ErrorCoded {
|
||||
|
||||
|
||||
/**
|
||||
* Return the error code associated with this failure.
|
||||
* Return the error code associated with this failure.
|
||||
* The GUI can render this any way it pleases, allowing for localization etc.
|
||||
* @return a String error code associated with this failure,
|
||||
* or <code>null</code> if not error-coded
|
||||
|
||||
@@ -32,7 +32,7 @@ import java.lang.reflect.Method;
|
||||
* @since 2.0
|
||||
*/
|
||||
public interface ParameterNameDiscoverer {
|
||||
|
||||
|
||||
/**
|
||||
* Return parameter names for this method,
|
||||
* or <code>null</code> if they cannot be determined.
|
||||
@@ -41,7 +41,7 @@ public interface ParameterNameDiscoverer {
|
||||
* or <code>null</code> if they cannot
|
||||
*/
|
||||
String[] getParameterNames(Method method);
|
||||
|
||||
|
||||
/**
|
||||
* Return parameter names for this constructor,
|
||||
* or <code>null</code> if they cannot be determined.
|
||||
|
||||
@@ -35,7 +35,7 @@ import java.util.List;
|
||||
* @since 2.0
|
||||
*/
|
||||
public class PrioritizedParameterNameDiscoverer implements ParameterNameDiscoverer {
|
||||
|
||||
|
||||
private final List<ParameterNameDiscoverer> parameterNameDiscoverers =
|
||||
new LinkedList<ParameterNameDiscoverer>();
|
||||
|
||||
|
||||
@@ -48,6 +48,6 @@ public abstract class AbstractGenericLabeledEnum extends AbstractLabeledEnum {
|
||||
else {
|
||||
return getCode().toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public class LetterCodedLabeledEnum extends AbstractGenericLabeledEnum {
|
||||
this.code = new Character(code);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Comparable getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public class ShortCodedLabeledEnum extends AbstractGenericLabeledEnum {
|
||||
this.code = new Short((short) code);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Comparable getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
@@ -18,9 +18,9 @@ package org.springframework.core.enums;
|
||||
|
||||
/**
|
||||
* Base class for static type-safe labeled enum instances.
|
||||
*
|
||||
*
|
||||
* Usage example:
|
||||
*
|
||||
*
|
||||
* <pre>
|
||||
* public class FlowSessionStatus extends StaticLabeledEnum {
|
||||
*
|
||||
@@ -30,15 +30,15 @@ package org.springframework.core.enums;
|
||||
* public static FlowSessionStatus PAUSED = new FlowSessionStatus(2, "Paused");
|
||||
* public static FlowSessionStatus SUSPENDED = new FlowSessionStatus(3, "Suspended");
|
||||
* public static FlowSessionStatus ENDED = new FlowSessionStatus(4, "Ended");
|
||||
*
|
||||
*
|
||||
* // private constructor!
|
||||
* private FlowSessionStatus(int code, String label) {
|
||||
* super(code, label);
|
||||
* }
|
||||
*
|
||||
*
|
||||
* // custom behavior
|
||||
* }</pre>
|
||||
*
|
||||
*
|
||||
* @author Keith Donald
|
||||
* @since 1.2.6
|
||||
* @deprecated as of Spring 3.0, in favor of Java 5 enums.
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.springframework.core.env;
|
||||
|
||||
|
||||
/**
|
||||
* Interface indicating a component contains and makes available an {@link Environment} object.
|
||||
* Interface indicating a component contains and makes available an {@link Environment} object.
|
||||
*
|
||||
* <p>All Spring application contexts are EnvironmentCapable, and the interface is used primarily
|
||||
* for performing {@code instanceof} checks in framework methods that accept BeanFactory
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2002-2012 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
|
||||
*
|
||||
*
|
||||
* http://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.
|
||||
@@ -29,7 +29,7 @@ import java.io.InputStream;
|
||||
* file-based <code>Resource</code> implementation can be used as a concrete
|
||||
* instance, allowing one to read the underlying content stream multiple times.
|
||||
* This makes this interface useful as an abstract content source for mail
|
||||
* attachments, for example.
|
||||
* attachments, for example.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @since 20.01.2004
|
||||
|
||||
@@ -66,7 +66,7 @@ import org.springframework.util.StringUtils;
|
||||
* Examples are real URLs such as "<code>file:C:/context.xml</code>", pseudo-URLs
|
||||
* such as "<code>classpath:/context.xml</code>", and simple unprefixed paths
|
||||
* such as "<code>/WEB-INF/context.xml</code>". The latter will resolve in a
|
||||
* fashion specific to the underlying <code>ResourceLoader</code> (e.g.
|
||||
* fashion specific to the underlying <code>ResourceLoader</code> (e.g.
|
||||
* <code>ServletContextResource</code> for a <code>WebApplicationContext</code>).
|
||||
*
|
||||
* <p><b>Ant-style Patterns:</b>
|
||||
@@ -147,7 +147,7 @@ import org.springframework.util.StringUtils;
|
||||
* com/mycompany/package1/service-context.xml
|
||||
* </pre>may be in only one location, but when a path such as<pre>
|
||||
* classpath:com/mycompany/**/service-context.xml
|
||||
* </pre>is used to try to resolve it, the resolver will work off the (first) URL
|
||||
* </pre>is used to try to resolve it, the resolver will work off the (first) URL
|
||||
* returned by <code>getResource("com/mycompany");</code>. If this base package
|
||||
* node exists in multiple classloader locations, the actual end resource may
|
||||
* not be underneath. Therefore, preferably, use "<code>classpath*:<code>" with the same
|
||||
@@ -695,7 +695,7 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol
|
||||
else if ("toString".equals(methodName)) {
|
||||
return toString();
|
||||
}
|
||||
|
||||
|
||||
throw new IllegalStateException("Unexpected method invocation: " + method);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,12 +24,12 @@ import org.springframework.core.NestedIOException;
|
||||
|
||||
/**
|
||||
* Deserializer that reads an input stream using Java Serialization.
|
||||
*
|
||||
*
|
||||
* @author Gary Russell
|
||||
* @author Mark Fisher
|
||||
* @since 3.0.5
|
||||
*/
|
||||
public class DefaultDeserializer implements Deserializer<Object> {
|
||||
public class DefaultDeserializer implements Deserializer<Object> {
|
||||
|
||||
/**
|
||||
* Reads the input stream and deserializes into an object.
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Serializer that writes an object to an output stream using Java Serialization.
|
||||
*
|
||||
*
|
||||
* @author Gary Russell
|
||||
* @author Mark Fisher
|
||||
* @since 3.0.5
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* A strategy interface for converting from data in an InputStream to an Object.
|
||||
*
|
||||
*
|
||||
* @author Gary Russell
|
||||
* @author Mark Fisher
|
||||
* @since 3.0.5
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.io.OutputStream;
|
||||
|
||||
/**
|
||||
* A strategy interface for streaming an object to an OutputStream.
|
||||
*
|
||||
*
|
||||
* @author Gary Russell
|
||||
* @author Mark Fisher
|
||||
* @since 3.0.5
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
/**
|
||||
*
|
||||
* Root package for Spring's serializer interfaces and implementations.
|
||||
* Root package for Spring's serializer interfaces and implementations.
|
||||
* Provides an abstraction over various serialization techniques.
|
||||
* Includes exceptions for serialization and deserialization failures.
|
||||
*
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
package org.springframework.core.style;
|
||||
|
||||
/**
|
||||
* Simple utility class to allow for convenient access to value
|
||||
* Simple utility class to allow for convenient access to value
|
||||
* styling logic, mainly to support descriptive logging messages.
|
||||
*
|
||||
* <p>For more sophisticated needs, use the {@link ValueStyler} abstraction
|
||||
@@ -30,7 +30,7 @@ package org.springframework.core.style;
|
||||
* @see DefaultValueStyler
|
||||
*/
|
||||
public abstract class StylerUtils {
|
||||
|
||||
|
||||
/**
|
||||
* Default ValueStyler instance used by the <code>style</code> method.
|
||||
* Also available for the {@link ToStringCreator} class in this package.
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.springframework.util.Assert;
|
||||
* Utility class that builds pretty-printing <code>toString()</code> methods
|
||||
* with pluggable styling conventions. By default, ToStringCreator adheres
|
||||
* to Spring's <code>toString()</code> styling conventions.
|
||||
*
|
||||
*
|
||||
* @author Keith Donald
|
||||
* @author Juergen Hoeller
|
||||
* @since 1.2.2
|
||||
|
||||
@@ -41,7 +41,7 @@ public class SyncTaskExecutor implements TaskExecutor, Serializable {
|
||||
/**
|
||||
* Executes the given <code>task</code> synchronously, through direct
|
||||
* invocation of it's {@link Runnable#run() run()} method.
|
||||
* @throws IllegalArgumentException if the given <code>task</code> is <code>null</code>
|
||||
* @throws IllegalArgumentException if the given <code>task</code> is <code>null</code>
|
||||
*/
|
||||
public void execute(Runnable task) {
|
||||
Assert.notNull(task, "Runnable must not be null");
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.util.concurrent.Executor;
|
||||
/**
|
||||
* Simple task executor interface that abstracts the execution
|
||||
* of a {@link Runnable}.
|
||||
*
|
||||
*
|
||||
* <p>Implementations can use all sorts of different execution strategies,
|
||||
* such as: synchronous, asynchronous, using a thread pool, and more.
|
||||
*
|
||||
|
||||
@@ -67,11 +67,11 @@ public class StandardMethodMetadata implements MethodMetadata {
|
||||
return this.introspectedMethod;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getMethodName() {
|
||||
return this.introspectedMethod.getName();
|
||||
}
|
||||
|
||||
|
||||
public String getDeclaringClassName() {
|
||||
return this.introspectedMethod.getDeclaringClass().getName();
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* Support classes for reading annotation and class-level metadata.
|
||||
*
|
||||
*
|
||||
*/
|
||||
package org.springframework.core.type.classreading;
|
||||
|
||||
|
||||
@@ -24,12 +24,12 @@ import org.springframework.core.type.classreading.MetadataReader;
|
||||
|
||||
/**
|
||||
* Type filter that is aware of traversing over hierarchy.
|
||||
*
|
||||
*
|
||||
* <p>This filter is useful when matching needs to be made based on potentially the
|
||||
* whole class/interface hierarchy. The algorithm employed uses a succeed-fast
|
||||
* strategy: if at any time a match is declared, no further processing is
|
||||
* carried out.
|
||||
*
|
||||
*
|
||||
* @author Ramnivas Laddad
|
||||
* @author Mark Fisher
|
||||
* @since 2.5
|
||||
|
||||
@@ -78,7 +78,7 @@ public class AnnotationTypeFilter extends AbstractTypeHierarchyTraversingFilter
|
||||
@Override
|
||||
protected boolean matchSelf(MetadataReader metadataReader) {
|
||||
AnnotationMetadata metadata = metadataReader.getAnnotationMetadata();
|
||||
return metadata.hasAnnotation(this.annotationType.getName()) ||
|
||||
return metadata.hasAnnotation(this.annotationType.getName()) ||
|
||||
(this.considerMetaAnnotations && metadata.hasMetaAnnotation(this.annotationType.getName()));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2002-2007 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
|
||||
*
|
||||
*
|
||||
* http://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.
|
||||
|
||||
@@ -37,7 +37,7 @@ import java.util.WeakHashMap;
|
||||
* <p>This class is an abstract template. Caching Map implementations
|
||||
* should subclass and override the <code>create(key)</code> method which
|
||||
* encapsulates expensive creation of a new object.
|
||||
*
|
||||
*
|
||||
* @author Keith Donald
|
||||
* @author Juergen Hoeller
|
||||
* @since 1.2.2
|
||||
|
||||
@@ -54,7 +54,7 @@ public abstract class ConcurrencyThrottleSupport implements Serializable {
|
||||
* Switch concurrency 'off': that is, don't allow any concurrent invocations.
|
||||
*/
|
||||
public static final int NO_CONCURRENCY = 0;
|
||||
|
||||
|
||||
|
||||
/** Transient to optimize serialization */
|
||||
protected transient Log logger = LogFactory.getLog(getClass());
|
||||
@@ -99,7 +99,7 @@ public abstract class ConcurrencyThrottleSupport implements Serializable {
|
||||
/**
|
||||
* To be invoked before the main execution logic of concrete subclasses.
|
||||
* <p>This implementation applies the concurrency throttle.
|
||||
* @see #afterAccess()
|
||||
* @see #afterAccess()
|
||||
*/
|
||||
protected void beforeAccess() {
|
||||
if (this.concurrencyLimit == NO_CONCURRENCY) {
|
||||
|
||||
@@ -67,7 +67,7 @@ public abstract class DigestUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new {@link MessageDigest} with the given algorithm. Necessary
|
||||
* Creates a new {@link MessageDigest} with the given algorithm. Necessary
|
||||
* because {@code MessageDigest} is not thread-safe.
|
||||
*/
|
||||
private static MessageDigest getDigest(String algorithm) {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2002-2005 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
|
||||
*
|
||||
*
|
||||
* http://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.
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.springframework.util.PropertyPlaceholderHelper.PlaceholderResolver;
|
||||
* Helper class for resolving placeholders in texts. Usually applied to file paths.
|
||||
*
|
||||
* <p>A text may contain <code>${...}</code> placeholders, to be resolved as system properties: e.g.
|
||||
* <code>${user.dir}</code>. Default values can be supplied using the ":" separator between key
|
||||
* <code>${user.dir}</code>. Default values can be supplied using the ":" separator between key
|
||||
* and value.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
|
||||
@@ -212,7 +212,7 @@ public abstract class TypeUtils {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public static boolean isAssignableBound(Type lhsType, Type rhsType) {
|
||||
if (rhsType == null) {
|
||||
return true;
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.util.Comparator;
|
||||
* Comparator that adapts Comparables to the Comparator interface.
|
||||
* Mainly for internal use in other Comparators, when supposed
|
||||
* to work on Comparables.
|
||||
*
|
||||
*
|
||||
* @author Keith Donald
|
||||
* @since 1.2.2
|
||||
* @see Comparable
|
||||
|
||||
@@ -32,7 +32,7 @@ import org.springframework.util.Assert;
|
||||
*
|
||||
* <p>This facilitates in-memory sorting similar to multi-column sorting in SQL.
|
||||
* The order of any single Comparator in the list can also be reversed.
|
||||
*
|
||||
*
|
||||
* @author Keith Donald
|
||||
* @author Juergen Hoeller
|
||||
* @since 1.2.2
|
||||
|
||||
@@ -119,7 +119,7 @@ public abstract class DomUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve all child elements of the given DOM element
|
||||
* Retrieve all child elements of the given DOM element
|
||||
|
||||
* @param ele the DOM element to analyze
|
||||
* @return a List of child <code>org.w3c.dom.Element</code> instances
|
||||
|
||||
@@ -36,7 +36,7 @@ import org.springframework.util.Assert;
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @since 3.0.5
|
||||
* @see StaxUtils#createEventStreamWriter(javax.xml.stream.XMLEventWriter, javax.xml.stream.XMLEventFactory)
|
||||
* @see StaxUtils#createEventStreamWriter(javax.xml.stream.XMLEventWriter, javax.xml.stream.XMLEventFactory)
|
||||
*/
|
||||
class XMLEventStreamWriter implements XMLStreamWriter {
|
||||
|
||||
@@ -51,7 +51,7 @@ class XMLEventStreamWriter implements XMLStreamWriter {
|
||||
public XMLEventStreamWriter(XMLEventWriter eventWriter, XMLEventFactory eventFactory) {
|
||||
Assert.notNull(eventWriter, "'eventWriter' must not be null");
|
||||
Assert.notNull(eventFactory, "'eventFactory' must not be null");
|
||||
|
||||
|
||||
this.eventWriter = eventWriter;
|
||||
this.eventFactory = eventFactory;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2002-2005 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
|
||||
*
|
||||
*
|
||||
* http://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.
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
|
||||
/*
|
||||
* Copyright 2002-2005 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
|
||||
*
|
||||
*
|
||||
* http://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.
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2002-2005 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
|
||||
*
|
||||
*
|
||||
* http://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.
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2002-2006 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
|
||||
*
|
||||
*
|
||||
* http://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.
|
||||
@@ -33,7 +33,7 @@ public abstract class AbstractControlFlowTests extends TestCase {
|
||||
new Two().testing();
|
||||
new Three().test();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
public void testUnderPackage() {
|
||||
ControlFlow cflow = new ControlFlow();
|
||||
@@ -43,7 +43,7 @@ public abstract class AbstractControlFlowTests extends TestCase {
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
public class One {
|
||||
|
||||
public void test() {
|
||||
|
||||
@@ -882,7 +882,7 @@ public class BridgeMethodResolverTests {
|
||||
}
|
||||
|
||||
|
||||
public class GenericHibernateRepository<T, ID extends Serializable>
|
||||
public class GenericHibernateRepository<T, ID extends Serializable>
|
||||
implements ConvenientGenericRepository<T, ID> {
|
||||
|
||||
/**
|
||||
|
||||
@@ -33,7 +33,7 @@ public class ConstantsTests extends TestCase {
|
||||
Constants c = new Constants(A.class);
|
||||
assertEquals(A.class.getName(), c.getClassName());
|
||||
assertEquals(9, c.getSize());
|
||||
|
||||
|
||||
assertEquals(c.asNumber("DOG").intValue(), A.DOG);
|
||||
assertEquals(c.asNumber("dog").intValue(), A.DOG);
|
||||
assertEquals(c.asNumber("cat").intValue(), A.CAT);
|
||||
|
||||
@@ -22,7 +22,7 @@ package org.springframework.core;
|
||||
* @author Rod Johnson
|
||||
*/
|
||||
public class DefaultControlFlowTests extends AbstractControlFlowTests {
|
||||
|
||||
|
||||
/**
|
||||
* Necessary only because Eclipse won't run test suite unless
|
||||
* it declares some methods as well as inherited methods.
|
||||
|
||||
@@ -22,7 +22,7 @@ package org.springframework.core;
|
||||
* @author Rod Johnson
|
||||
*/
|
||||
public class Jdk14ControlFlowTests extends AbstractControlFlowTests {
|
||||
|
||||
|
||||
/**
|
||||
* Necessary only because Eclipse won't run test suite unless it declares
|
||||
* some methods as well as inherited methods
|
||||
|
||||
@@ -189,7 +189,7 @@ public class LocalVariableTableParameterNameDiscovererTests extends TestCase {
|
||||
m = clazz.getMethod("getDate", null);
|
||||
names = discoverer.getParameterNames(m);
|
||||
assertEquals(0, names.length);
|
||||
|
||||
|
||||
//System.in.read();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2002-2005 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
|
||||
*
|
||||
*
|
||||
* http://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.
|
||||
@@ -70,7 +70,7 @@ public class NestedExceptionTests extends TestCase {
|
||||
NestedCheckedException nex = new NestedCheckedException(mesg) {};
|
||||
assertNull(nex.getCause());
|
||||
assertEquals(nex.getMessage(), mesg);
|
||||
|
||||
|
||||
// Check printStackTrace
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
PrintWriter pw = new PrintWriter(baos);
|
||||
@@ -79,7 +79,7 @@ public class NestedExceptionTests extends TestCase {
|
||||
String stackTrace = new String(baos.toByteArray());
|
||||
assertFalse(stackTrace.indexOf(mesg) == -1);
|
||||
}
|
||||
|
||||
|
||||
public void testNestedCheckedExceptionWithRootCause() {
|
||||
String myMessage = "mesg for this exception";
|
||||
String rootCauseMesg = "this is the obscure message of the root cause";
|
||||
@@ -89,7 +89,7 @@ public class NestedExceptionTests extends TestCase {
|
||||
Assert.assertEquals(nex.getCause(), rootCause);
|
||||
assertTrue(nex.getMessage().indexOf(myMessage) != -1);
|
||||
assertTrue(nex.getMessage().indexOf(rootCauseMesg) != -1);
|
||||
|
||||
|
||||
// check PrintStackTrace
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
PrintWriter pw = new PrintWriter(baos);
|
||||
|
||||
@@ -25,11 +25,11 @@ import junit.framework.TestCase;
|
||||
import org.springframework.beans.TestBean;
|
||||
|
||||
public class PrioritizedParameterNameDiscovererTests extends TestCase {
|
||||
|
||||
|
||||
private static final String[] FOO_BAR = new String[] { "foo", "bar" };
|
||||
|
||||
|
||||
private static final String[] SOMETHING_ELSE = new String[] { "something", "else" };
|
||||
|
||||
|
||||
ParameterNameDiscoverer returnsFooBar = new ParameterNameDiscoverer() {
|
||||
public String[] getParameterNames(Method m) {
|
||||
return FOO_BAR;
|
||||
@@ -38,7 +38,7 @@ public class PrioritizedParameterNameDiscovererTests extends TestCase {
|
||||
return FOO_BAR;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ParameterNameDiscoverer returnsSomethingElse = new ParameterNameDiscoverer() {
|
||||
public String[] getParameterNames(Method m) {
|
||||
return SOMETHING_ELSE;
|
||||
@@ -47,20 +47,20 @@ public class PrioritizedParameterNameDiscovererTests extends TestCase {
|
||||
return SOMETHING_ELSE;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
private final Method anyMethod;
|
||||
private final Class anyClass = Object.class;
|
||||
|
||||
|
||||
public PrioritizedParameterNameDiscovererTests() throws SecurityException, NoSuchMethodException {
|
||||
anyMethod = TestBean.class.getMethod("getAge", (Class[]) null);
|
||||
}
|
||||
|
||||
|
||||
public void testNoParametersDiscoverers() {
|
||||
ParameterNameDiscoverer pnd = new PrioritizedParameterNameDiscoverer();
|
||||
assertNull(pnd.getParameterNames(anyMethod));
|
||||
assertNull(pnd.getParameterNames((Constructor) null));
|
||||
}
|
||||
|
||||
|
||||
public void testOrderedParameterDiscoverers1() {
|
||||
PrioritizedParameterNameDiscoverer pnd = new PrioritizedParameterNameDiscoverer();
|
||||
pnd.addDiscoverer(returnsFooBar);
|
||||
@@ -70,7 +70,7 @@ public class PrioritizedParameterNameDiscovererTests extends TestCase {
|
||||
assertTrue(Arrays.equals(FOO_BAR, pnd.getParameterNames(anyMethod)));
|
||||
assertTrue(Arrays.equals(FOO_BAR, pnd.getParameterNames((Constructor) null)));
|
||||
}
|
||||
|
||||
|
||||
public void testOrderedParameterDiscoverers2() {
|
||||
PrioritizedParameterNameDiscoverer pnd = new PrioritizedParameterNameDiscoverer();
|
||||
pnd.addDiscoverer(returnsSomethingElse);
|
||||
|
||||
@@ -363,5 +363,5 @@ public class AnnotationUtilsTests {
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Inherited
|
||||
@interface Transactional {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link AbstractPropertySource} implementations.
|
||||
*
|
||||
*
|
||||
* @author Chris Beams
|
||||
* @since 3.1
|
||||
*/
|
||||
|
||||
@@ -137,14 +137,14 @@ public class PathMatchingResourcePatternResolverTests {
|
||||
// List expectedNames = new LinkedList(Arrays.asList(fileNames));
|
||||
// Collections.sort(sortedActualNames);
|
||||
// Collections.sort(expectedNames);
|
||||
//
|
||||
//
|
||||
// System.out.println("-----------");
|
||||
// System.out.println("Expected: " + StringUtils.collectionToCommaDelimitedString(expectedNames));
|
||||
// System.out.println("Actual: " + StringUtils.collectionToCommaDelimitedString(sortedActualNames));
|
||||
// for (int i = 0; i < resources.length; i++) {
|
||||
// System.out.println(resources[i]);
|
||||
// }
|
||||
|
||||
|
||||
assertEquals("Correct number of files found", fileNames.length, resources.length);
|
||||
for (int i = 0; i < resources.length; i++) {
|
||||
Resource resource = resources[i];
|
||||
|
||||
@@ -40,7 +40,7 @@ public class ResourceArrayPropertyEditorTests {
|
||||
|
||||
@Test
|
||||
public void testPatternResource() throws Exception {
|
||||
// N.B. this will sometimes fail if you use classpath: instead of classpath*:.
|
||||
// N.B. this will sometimes fail if you use classpath: instead of classpath*:.
|
||||
// The result depends on the classpath - if test-classes are segregated from classes
|
||||
// and they come first on the classpath (like in Maven) then it breaks, if classes
|
||||
// comes first (like in Spring Build) then it is OK.
|
||||
|
||||
@@ -214,7 +214,7 @@ public class AnnotationMetadataTests {
|
||||
})
|
||||
@SuppressWarnings({"serial", "unused"})
|
||||
private static class AnnotatedComponent implements Serializable {
|
||||
|
||||
|
||||
@TestAutowired
|
||||
public void doWork(@TestQualifier("myColor") java.awt.Color color) {
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public class AssignableTypeFilterTests extends TestCase {
|
||||
assertFalse(notMatchingFilter.match(metadataReader, metadataReaderFactory));
|
||||
assertTrue(matchingFilter.match(metadataReader, metadataReaderFactory));
|
||||
}
|
||||
|
||||
|
||||
public void testInterfaceMatch() throws Exception {
|
||||
MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory();
|
||||
String classUnderTest = "org.springframework.core.type.AssignableTypeFilterTests$TestInterfaceImpl";
|
||||
@@ -49,7 +49,7 @@ public class AssignableTypeFilterTests extends TestCase {
|
||||
assertTrue(filter.match(metadataReader, metadataReaderFactory));
|
||||
ClassloadingAssertions.assertClassNotLoaded(classUnderTest);
|
||||
}
|
||||
|
||||
|
||||
public void testSuperClassMatch() throws Exception {
|
||||
MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory();
|
||||
String classUnderTest = "org.springframework.core.type.AssignableTypeFilterTests$SomeDaoLikeImpl";
|
||||
@@ -59,7 +59,7 @@ public class AssignableTypeFilterTests extends TestCase {
|
||||
assertTrue(filter.match(metadataReader, metadataReaderFactory));
|
||||
ClassloadingAssertions.assertClassNotLoaded(classUnderTest);
|
||||
}
|
||||
|
||||
|
||||
public void testInterfaceThroughSuperClassMatch() throws Exception {
|
||||
MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory();
|
||||
String classUnderTest = "org.springframework.core.type.AssignableTypeFilterTests$SomeDaoLikeImpl";
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2006-2010 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
|
||||
*
|
||||
*
|
||||
* http://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.
|
||||
@@ -32,8 +32,8 @@ import org.springframework.core.type.classreading.SimpleMetadataReaderFactory;
|
||||
/**
|
||||
* Unit test checking the behaviour of {@link CachingMetadataReaderFactory under load.
|
||||
* If the cache is not controller, this test should fail with an out of memory exception around entry
|
||||
* 5k.
|
||||
*
|
||||
* 5k.
|
||||
*
|
||||
* @author Costin Leau
|
||||
*/
|
||||
public class CachingMetadataReaderLeakTest {
|
||||
|
||||
@@ -9,7 +9,7 @@ import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
* Test case for {@link CompositeIterator}.
|
||||
*
|
||||
*
|
||||
* @author Erwin Vervaet
|
||||
*/
|
||||
public class CompositeIteratorTests extends TestCase {
|
||||
|
||||
@@ -24,51 +24,51 @@ import junit.framework.TestCase;
|
||||
* @author Rob Harrop
|
||||
*/
|
||||
public class FileSystemUtilsTests extends TestCase {
|
||||
|
||||
|
||||
public void testDeleteRecursively() throws Exception {
|
||||
File root = new File("./tmp/root");
|
||||
File child = new File(root, "child");
|
||||
File grandchild = new File(child, "grandchild");
|
||||
|
||||
|
||||
grandchild.mkdirs();
|
||||
|
||||
|
||||
File bar = new File(child, "bar.txt");
|
||||
bar.createNewFile();
|
||||
|
||||
|
||||
assertTrue(root.exists());
|
||||
assertTrue(child.exists());
|
||||
assertTrue(grandchild.exists());
|
||||
assertTrue(bar.exists());
|
||||
|
||||
|
||||
FileSystemUtils.deleteRecursively(root);
|
||||
|
||||
|
||||
assertFalse(root.exists());
|
||||
assertFalse(child.exists());
|
||||
assertFalse(grandchild.exists());
|
||||
assertFalse(bar.exists());
|
||||
}
|
||||
|
||||
|
||||
public void testCopyRecursively() throws Exception {
|
||||
File src = new File("./tmp/src");
|
||||
File child = new File(src, "child");
|
||||
File grandchild = new File(child, "grandchild");
|
||||
|
||||
|
||||
grandchild.mkdirs();
|
||||
|
||||
|
||||
File bar = new File(child, "bar.txt");
|
||||
bar.createNewFile();
|
||||
|
||||
|
||||
assertTrue(src.exists());
|
||||
assertTrue(child.exists());
|
||||
assertTrue(grandchild.exists());
|
||||
assertTrue(bar.exists());
|
||||
|
||||
|
||||
File dest = new File("./dest");
|
||||
FileSystemUtils.copyRecursively(src, dest);
|
||||
|
||||
|
||||
assertTrue(dest.exists());
|
||||
assertTrue(new File(dest, child.getName()).exists());
|
||||
|
||||
|
||||
FileSystemUtils.deleteRecursively(src);
|
||||
assertTrue(!src.exists());
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2002-2005 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
|
||||
*
|
||||
*
|
||||
* http://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.
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2002-2005 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
|
||||
*
|
||||
*
|
||||
* http://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.
|
||||
@@ -26,11 +26,11 @@ import org.apache.log4j.spi.LoggingEvent;
|
||||
* @author Alef Arendsen
|
||||
*/
|
||||
public class MockLog4jAppender extends AppenderSkeleton {
|
||||
|
||||
|
||||
public static final List loggingStrings = new ArrayList();
|
||||
|
||||
|
||||
public static boolean closeCalled = false;
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.apache.log4j.AppenderSkeleton#append(org.apache.log4j.spi.LoggingEvent)
|
||||
*/
|
||||
@@ -38,7 +38,7 @@ public class MockLog4jAppender extends AppenderSkeleton {
|
||||
//System.out.println("Adding " + evt.getMessage());
|
||||
loggingStrings.add(evt.getMessage());
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.apache.log4j.Appender#close()
|
||||
*/
|
||||
@@ -49,11 +49,11 @@ public class MockLog4jAppender extends AppenderSkeleton {
|
||||
/* (non-Javadoc)
|
||||
* @see org.apache.log4j.Appender#requiresLayout()
|
||||
*/
|
||||
public boolean requiresLayout() {
|
||||
public boolean requiresLayout() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ public class PropertyPlaceholderHelperTests {
|
||||
String text = "foo=${foo},bar=${bar}";
|
||||
Properties props = new Properties();
|
||||
props.setProperty("foo", "bar");
|
||||
|
||||
|
||||
assertEquals("foo=bar,bar=${bar}", this.helper.replacePlaceholders(text, props));
|
||||
}
|
||||
|
||||
|
||||
@@ -27,13 +27,13 @@ import org.springframework.beans.TestBean;
|
||||
* @author Rod Johnson
|
||||
*/
|
||||
public class SerializationTestUtils extends TestCase {
|
||||
|
||||
|
||||
public static void testSerialization(Object o) throws IOException {
|
||||
OutputStream baos = new ByteArrayOutputStream();
|
||||
ObjectOutputStream oos = new ObjectOutputStream(baos);
|
||||
oos.writeObject(o);
|
||||
}
|
||||
|
||||
|
||||
public static boolean isSerializable(Object o) throws IOException {
|
||||
try {
|
||||
testSerialization(o);
|
||||
@@ -43,7 +43,7 @@ public class SerializationTestUtils extends TestCase {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static Object serializeAndDeserialize(Object o) throws IOException, ClassNotFoundException {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
ObjectOutputStream oos = new ObjectOutputStream(baos);
|
||||
@@ -51,24 +51,24 @@ public class SerializationTestUtils extends TestCase {
|
||||
oos.flush();
|
||||
baos.flush();
|
||||
byte[] bytes = baos.toByteArray();
|
||||
|
||||
|
||||
ByteArrayInputStream is = new ByteArrayInputStream(bytes);
|
||||
ObjectInputStream ois = new ObjectInputStream(is);
|
||||
Object o2 = ois.readObject();
|
||||
|
||||
|
||||
return o2;
|
||||
}
|
||||
|
||||
|
||||
public SerializationTestUtils(String s) {
|
||||
super(s);
|
||||
}
|
||||
|
||||
|
||||
public void testWithNonSerializableObject() throws IOException {
|
||||
TestBean o = new TestBean();
|
||||
assertFalse(o instanceof Serializable);
|
||||
|
||||
|
||||
assertFalse(isSerializable(o));
|
||||
|
||||
|
||||
try {
|
||||
testSerialization(o);
|
||||
fail();
|
||||
@@ -77,17 +77,17 @@ public class SerializationTestUtils extends TestCase {
|
||||
// Ok
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void testWithSerializableObject() throws Exception {
|
||||
int x = 5;
|
||||
int y = 10;
|
||||
Point p = new Point(x, y);
|
||||
assertTrue(p instanceof Serializable);
|
||||
|
||||
|
||||
testSerialization(p);
|
||||
|
||||
|
||||
assertTrue(isSerializable(p));
|
||||
|
||||
|
||||
Point p2 = (Point) serializeAndDeserialize(p);
|
||||
assertNotSame(p, p2);
|
||||
assertEquals(x, (int) p2.getX());
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.springframework.util.SerializationUtils;
|
||||
|
||||
/**
|
||||
* Test for static utility to help with serialization.
|
||||
*
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @since 3.0.5
|
||||
*/
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
|
||||
|
||||
/*
|
||||
* Copyright 2002-2005 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
|
||||
*
|
||||
*
|
||||
* http://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.
|
||||
@@ -33,17 +33,17 @@ public class StopWatchTests extends TestCase {
|
||||
long int2 = 45L;
|
||||
String name1 = "Task 1";
|
||||
String name2 = "Task 2";
|
||||
|
||||
|
||||
long fudgeFactor = 5L;
|
||||
assertFalse(sw.isRunning());
|
||||
sw.start(name1);
|
||||
Thread.sleep(int1);
|
||||
assertTrue(sw.isRunning());
|
||||
sw.stop();
|
||||
|
||||
|
||||
// TODO are timings off in JUnit? Why do these assertions sometimes fail
|
||||
// under both Ant and Eclipse?
|
||||
|
||||
|
||||
//assertTrue("Unexpected timing " + sw.getTotalTime(), sw.getTotalTime() >= int1);
|
||||
//assertTrue("Unexpected timing " + sw.getTotalTime(), sw.getTotalTime() <= int1 + fudgeFactor);
|
||||
sw.start(name2);
|
||||
@@ -51,19 +51,19 @@ public class StopWatchTests extends TestCase {
|
||||
sw.stop();
|
||||
//assertTrue("Unexpected timing " + sw.getTotalTime(), sw.getTotalTime() >= int1 + int2);
|
||||
//assertTrue("Unexpected timing " + sw.getTotalTime(), sw.getTotalTime() <= int1 + int2 + fudgeFactor);
|
||||
|
||||
|
||||
assertTrue(sw.getTaskCount() == 2);
|
||||
String pp = sw.prettyPrint();
|
||||
assertTrue(pp.indexOf(name1) != -1);
|
||||
assertTrue(pp.indexOf(name2) != -1);
|
||||
|
||||
|
||||
StopWatch.TaskInfo[] tasks = sw.getTaskInfo();
|
||||
assertTrue(tasks.length == 2);
|
||||
assertTrue(tasks[0].getTaskName().equals(name1));
|
||||
assertTrue(tasks[1].getTaskName().equals(name2));
|
||||
sw.toString();
|
||||
}
|
||||
|
||||
|
||||
public void testValidUsageNotKeepingTaskList() throws Exception {
|
||||
StopWatch sw = new StopWatch();
|
||||
sw.setKeepTaskList(false);
|
||||
@@ -71,17 +71,17 @@ public class StopWatchTests extends TestCase {
|
||||
long int2 = 45L;
|
||||
String name1 = "Task 1";
|
||||
String name2 = "Task 2";
|
||||
|
||||
|
||||
long fudgeFactor = 5L;
|
||||
assertFalse(sw.isRunning());
|
||||
sw.start(name1);
|
||||
Thread.sleep(int1);
|
||||
assertTrue(sw.isRunning());
|
||||
sw.stop();
|
||||
|
||||
|
||||
// TODO are timings off in JUnit? Why do these assertions sometimes fail
|
||||
// under both Ant and Eclipse?
|
||||
|
||||
|
||||
//assertTrue("Unexpected timing " + sw.getTotalTime(), sw.getTotalTime() >= int1);
|
||||
//assertTrue("Unexpected timing " + sw.getTotalTime(), sw.getTotalTime() <= int1 + fudgeFactor);
|
||||
sw.start(name2);
|
||||
@@ -89,12 +89,12 @@ public class StopWatchTests extends TestCase {
|
||||
sw.stop();
|
||||
//assertTrue("Unexpected timing " + sw.getTotalTime(), sw.getTotalTime() >= int1 + int2);
|
||||
//assertTrue("Unexpected timing " + sw.getTotalTime(), sw.getTotalTime() <= int1 + int2 + fudgeFactor);
|
||||
|
||||
|
||||
assertTrue(sw.getTaskCount() == 2);
|
||||
String pp = sw.prettyPrint();
|
||||
assertTrue(pp.indexOf("kept") != -1);
|
||||
sw.toString();
|
||||
|
||||
|
||||
try {
|
||||
sw.getTaskInfo();
|
||||
fail();
|
||||
@@ -103,7 +103,7 @@ public class StopWatchTests extends TestCase {
|
||||
// Ok
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void testFailureToStartBeforeGettingTimings() {
|
||||
StopWatch sw = new StopWatch();
|
||||
try {
|
||||
@@ -114,7 +114,7 @@ public class StopWatchTests extends TestCase {
|
||||
// Ok
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void testFailureToStartBeforeStop() {
|
||||
StopWatch sw = new StopWatch();
|
||||
try {
|
||||
@@ -125,7 +125,7 @@ public class StopWatchTests extends TestCase {
|
||||
// Ok
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void testRejectsStartTwice() {
|
||||
StopWatch sw = new StopWatch();
|
||||
try {
|
||||
|
||||
@@ -42,7 +42,7 @@ public class XMLEventStreamWriterTests {
|
||||
XMLEventWriter eventWriter = outputFactory.createXMLEventWriter(stringWriter);
|
||||
streamWriter = new XMLEventStreamWriter(eventWriter, XMLEventFactory.newInstance());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void write() throws Exception {
|
||||
streamWriter.writeStartDocument();
|
||||
|
||||
Reference in New Issue
Block a user