Fixes for tests under windows.

git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/branches/archiva-jpox-database-refactor@532767 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Joakim Erdfelt 2007-04-26 14:57:16 +00:00
parent b0003019c0
commit 14e5ac5eb3
3 changed files with 12 additions and 7 deletions

View File

@ -102,7 +102,7 @@ public class XMLReader
try try
{ {
InputStream in = url.openStream(); InputStream in = url.openStream();
InputStreamReader inReader = new InputStreamReader( in ); InputStreamReader inReader = new InputStreamReader( in, "UTF-8" );
LatinEntityResolutionReader latinReader = new LatinEntityResolutionReader( inReader ); LatinEntityResolutionReader latinReader = new LatinEntityResolutionReader( inReader );
this.document = reader.read( latinReader ); this.document = reader.read( latinReader );
} }

View File

@ -33,9 +33,9 @@ public class LatinEntitiesTest
public void testResolveEntity() public void testResolveEntity()
{ {
// Good Entities. // Good Entities.
assertEquals( "©", LatinEntities.resolveEntity( "©" ) ); assertEquals( "\u00a9", LatinEntities.resolveEntity( "©" ) );
assertEquals( "", LatinEntities.resolveEntity( "∞" ) ); assertEquals( "\u221e", LatinEntities.resolveEntity( "∞" ) );
assertEquals( "ø", LatinEntities.resolveEntity( "ø" ) ); assertEquals( "\u00f8", LatinEntities.resolveEntity( "ø" ) );
// Bad Entities. // Bad Entities.
assertEquals( "", LatinEntities.resolveEntity( "" ) ); assertEquals( "", LatinEntities.resolveEntity( "" ) );

View File

@ -35,6 +35,11 @@ import java.util.List;
public class XMLReaderTest public class XMLReaderTest
extends AbstractArchivaXmlTestCase extends AbstractArchivaXmlTestCase
{ {
private static final String OSLASH = "\u00f8";
private static final String TRYGVIS = "Trygve Laugst" + OSLASH + "l";
private static final String INFIN = "\u221e";
private static final String INFINITE_ARCHIVA = "The " + INFIN + " Archiva";
private void assertElementTexts( List elementList, String[] expectedTexts ) private void assertElementTexts( List elementList, String[] expectedTexts )
{ {
assertEquals( "Element List Size", expectedTexts.length, elementList.size() ); assertEquals( "Element List Size", expectedTexts.length, elementList.size() );
@ -70,7 +75,7 @@ public class XMLReaderTest
XMLReader reader = new XMLReader( "basic", xmlFile ); XMLReader reader = new XMLReader( "basic", xmlFile );
List names = reader.getElementList( "//basic/names/name" ); List names = reader.getElementList( "//basic/names/name" );
assertElementTexts( names, new String[] { "Trygve Laugstøl", "The ∞ Archiva" } ); assertElementTexts( names, new String[] { TRYGVIS, INFINITE_ARCHIVA } );
} }
public void testNoPrologUtf8Read() public void testNoPrologUtf8Read()
@ -80,7 +85,7 @@ public class XMLReaderTest
XMLReader reader = new XMLReader( "basic", xmlFile ); XMLReader reader = new XMLReader( "basic", xmlFile );
List names = reader.getElementList( "//basic/names/name" ); List names = reader.getElementList( "//basic/names/name" );
assertElementTexts( names, new String[] { "Trygve Laugstøl", "The ∞ Archiva" } ); assertElementTexts( names, new String[] { TRYGVIS, INFINITE_ARCHIVA } );
} }
public void testPrologUtf8Read() public void testPrologUtf8Read()
@ -90,7 +95,7 @@ public class XMLReaderTest
XMLReader reader = new XMLReader( "basic", xmlFile ); XMLReader reader = new XMLReader( "basic", xmlFile );
List names = reader.getElementList( "//basic/names/name" ); List names = reader.getElementList( "//basic/names/name" );
assertElementTexts( names, new String[] { "Trygve Laugstøl", "The ∞ Archiva" } ); assertElementTexts( names, new String[] { TRYGVIS, INFINITE_ARCHIVA } );
} }
} }