From: <bo...@us...> - 2010-04-30 09:24:33
|
Revision: 372 http://xmlunit.svn.sourceforge.net/xmlunit/?rev=372&view=rev Author: bodewig Date: 2010-04-30 09:24:27 +0000 (Fri, 30 Apr 2010) Log Message: ----------- use a better name for test resources constants Modified Paths: -------------- trunk/xmlunit/src/tests/java-core/net/sf/xmlunit/builder/InputTest.java trunk/xmlunit/src/tests/java-core/net/sf/xmlunit/util/ConvertTest.java trunk/xmlunit/src/tests/java-core/net/sf/xmlunit/xpath/JAXPXPathEngineTest.java Added Paths: ----------- trunk/xmlunit/src/tests/java-core/net/sf/xmlunit/TestResources.java Removed Paths: ------------- trunk/xmlunit/src/tests/java-core/net/sf/xmlunit/Resources.java Deleted: trunk/xmlunit/src/tests/java-core/net/sf/xmlunit/Resources.java =================================================================== --- trunk/xmlunit/src/tests/java-core/net/sf/xmlunit/Resources.java 2010-04-30 09:08:03 UTC (rev 371) +++ trunk/xmlunit/src/tests/java-core/net/sf/xmlunit/Resources.java 2010-04-30 09:24:27 UTC (rev 372) @@ -1,22 +0,0 @@ -/* - This file is licensed to You 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. - See the License for the specific language governing permissions and - limitations under the License. -*/ -package net.sf.xmlunit; - -public final class Resources { - public static final String ANIMAL_FILE = "src/tests/resources/test1.xml"; - public static final String BLAME_FILE = "src/tests/resources/test.blame.html"; - - private Resources() { } - -} Copied: trunk/xmlunit/src/tests/java-core/net/sf/xmlunit/TestResources.java (from rev 370, trunk/xmlunit/src/tests/java-core/net/sf/xmlunit/Resources.java) =================================================================== --- trunk/xmlunit/src/tests/java-core/net/sf/xmlunit/TestResources.java (rev 0) +++ trunk/xmlunit/src/tests/java-core/net/sf/xmlunit/TestResources.java 2010-04-30 09:24:27 UTC (rev 372) @@ -0,0 +1,22 @@ +/* + This file is licensed to You 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. + See the License for the specific language governing permissions and + limitations under the License. +*/ +package net.sf.xmlunit; + +public final class TestResources { + public static final String ANIMAL_FILE = "src/tests/resources/test1.xml"; + public static final String BLAME_FILE = "src/tests/resources/test.blame.html"; + + private TestResources() { } + +} Modified: trunk/xmlunit/src/tests/java-core/net/sf/xmlunit/builder/InputTest.java =================================================================== --- trunk/xmlunit/src/tests/java-core/net/sf/xmlunit/builder/InputTest.java 2010-04-30 09:08:03 UTC (rev 371) +++ trunk/xmlunit/src/tests/java-core/net/sf/xmlunit/builder/InputTest.java 2010-04-30 09:24:27 UTC (rev 372) @@ -23,7 +23,7 @@ import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.transform.Source; import org.w3c.dom.Document; -import net.sf.xmlunit.Resources; +import net.sf.xmlunit.TestResources; import net.sf.xmlunit.util.Convert; import org.junit.Test; @@ -41,23 +41,23 @@ } @Test public void shouldParseADocument() throws Exception { - Document d = parse(Input.fromFile(Resources.ANIMAL_FILE).build()); + Document d = parse(Input.fromFile(TestResources.ANIMAL_FILE).build()); Source s = Input.fromDocument(d).build(); allIsWellFor(s); } @Test public void shouldParseAnExistingFileByName() throws Exception { - allIsWellFor(Input.fromFile(Resources.ANIMAL_FILE).build()); + allIsWellFor(Input.fromFile(TestResources.ANIMAL_FILE).build()); } @Test public void shouldParseAnExistingFileByFile() throws Exception { - allIsWellFor(Input.fromFile(new File(Resources.ANIMAL_FILE)).build()); + allIsWellFor(Input.fromFile(new File(TestResources.ANIMAL_FILE)).build()); } @Test public void shouldParseAnExistingFileFromStream() throws Exception { FileInputStream is = null; try { - is = new FileInputStream(Resources.ANIMAL_FILE); + is = new FileInputStream(TestResources.ANIMAL_FILE); allIsWellFor(Input.fromStream(is).build()); } finally { if (is != null) { @@ -69,7 +69,7 @@ @Test public void shouldParseAnExistingFileFromReader() throws Exception { FileReader r = null; try { - r = new FileReader(Resources.ANIMAL_FILE); + r = new FileReader(TestResources.ANIMAL_FILE); allIsWellFor(Input.fromReader(r).build()); } finally { if (r != null) { @@ -88,15 +88,15 @@ } @Test public void shouldParseFileFromURIString() throws Exception { - allIsWellFor(Input.fromURI("file:" + Resources.ANIMAL_FILE).build()); + allIsWellFor(Input.fromURI("file:" + TestResources.ANIMAL_FILE).build()); } @Test public void shouldParseFileFromURI() throws Exception { - allIsWellFor(Input.fromURI(new URI("file:" + Resources.ANIMAL_FILE)).build()); + allIsWellFor(Input.fromURI(new URI("file:" + TestResources.ANIMAL_FILE)).build()); } @Test public void shouldParseFileFromURL() throws Exception { - allIsWellFor(Input.fromURL(new URL("file:" + Resources.ANIMAL_FILE)).build()); + allIsWellFor(Input.fromURL(new URL("file:" + TestResources.ANIMAL_FILE)).build()); } @Test public void shouldParseATransformationFromSource() throws Exception { @@ -129,7 +129,7 @@ } private static byte[] readTestFile() throws Exception { - FileInputStream is = new FileInputStream(Resources.ANIMAL_FILE); + FileInputStream is = new FileInputStream(TestResources.ANIMAL_FILE); ByteArrayOutputStream bos = new ByteArrayOutputStream(); byte[] buffer = new byte[1024]; int read = -1; Modified: trunk/xmlunit/src/tests/java-core/net/sf/xmlunit/util/ConvertTest.java =================================================================== --- trunk/xmlunit/src/tests/java-core/net/sf/xmlunit/util/ConvertTest.java 2010-04-30 09:08:03 UTC (rev 371) +++ trunk/xmlunit/src/tests/java-core/net/sf/xmlunit/util/ConvertTest.java 2010-04-30 09:24:27 UTC (rev 372) @@ -21,7 +21,7 @@ import javax.xml.transform.dom.DOMSource; import javax.xml.transform.sax.SAXSource; import javax.xml.transform.stream.StreamSource; -import net.sf.xmlunit.Resources; +import net.sf.xmlunit.TestResources; import org.hamcrest.core.IsNull; import org.junit.Test; import org.w3c.dom.Document; @@ -41,18 +41,18 @@ } @Test public void streamSourceToInputSource() throws Exception { - convertAndAssert(new StreamSource(new File(Resources.ANIMAL_FILE))); + convertAndAssert(new StreamSource(new File(TestResources.ANIMAL_FILE))); } @Test public void domSourceToInputSource() throws Exception { DocumentBuilder b = DocumentBuilderFactory.newInstance().newDocumentBuilder(); - Document d = b.parse(new File(Resources.ANIMAL_FILE)); + Document d = b.parse(new File(TestResources.ANIMAL_FILE)); convertAndAssert(new DOMSource(d)); } @Test public void saxSourceToInputSource() throws Exception { - InputSource s = new InputSource(new FileInputStream(Resources.ANIMAL_FILE)); + InputSource s = new InputSource(new FileInputStream(TestResources.ANIMAL_FILE)); convertAndAssert(new SAXSource(s)); } Modified: trunk/xmlunit/src/tests/java-core/net/sf/xmlunit/xpath/JAXPXPathEngineTest.java =================================================================== --- trunk/xmlunit/src/tests/java-core/net/sf/xmlunit/xpath/JAXPXPathEngineTest.java 2010-04-30 09:08:03 UTC (rev 371) +++ trunk/xmlunit/src/tests/java-core/net/sf/xmlunit/xpath/JAXPXPathEngineTest.java 2010-04-30 09:24:27 UTC (rev 372) @@ -16,7 +16,7 @@ import java.util.HashMap; import java.util.Iterator; import javax.xml.transform.Source; -import net.sf.xmlunit.Resources; +import net.sf.xmlunit.TestResources; import net.sf.xmlunit.builder.Input; import net.sf.xmlunit.exceptions.XMLUnitException; import org.junit.Before; @@ -30,7 +30,7 @@ private Source source; @Before public void readSource() throws Exception { - source = Input.fromFile(Resources.BLAME_FILE).build(); + source = Input.fromFile(TestResources.BLAME_FILE).build(); } @Test public void selectNodesWithNoMatches() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |