Removed badly encoded character from test class. Minor re-formatting
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@776041 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8cfca324f1
commit
b924e3f4c8
@ -76,9 +76,8 @@ import org.apache.poi.openxml4j.opc.PackagingURIHelper;
|
||||
* case-insensitive ASCII strings. [M1.12]
|
||||
*
|
||||
* @author Julien Chable
|
||||
* @version 1.0
|
||||
*/
|
||||
public class TestOPCCompliancePartName extends TestCase {
|
||||
public final class TestOPCCompliancePartName extends TestCase {
|
||||
|
||||
public TestOPCCompliancePartName(String name) {
|
||||
super(name);
|
||||
@ -150,13 +149,13 @@ public class TestOPCCompliancePartName extends TestCase {
|
||||
}
|
||||
|
||||
/**
|
||||
* A segment shall not hold any characters other than pchar characters.
|
||||
* A segment shall not hold any characters other than ipchar (RFC 3987) characters.
|
||||
* [M1.6].
|
||||
*/
|
||||
public void testPartNameWithNonPCharCharacters() {
|
||||
String[] invalidNames = { "/doc<EFBFBD>&.xml" };
|
||||
String[] validNames = { "/doc&.xml" };
|
||||
try {
|
||||
for (String s : invalidNames)
|
||||
for (String s : validNames)
|
||||
assertTrue(
|
||||
"A segment shall not contain non pchar characters [M1.6] : "
|
||||
+ s, PackagingURIHelper
|
||||
@ -206,7 +205,6 @@ public class TestOPCCompliancePartName extends TestCase {
|
||||
} catch (InvalidFormatException e) {
|
||||
// Normal behaviour
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -214,15 +212,11 @@ public class TestOPCCompliancePartName extends TestCase {
|
||||
* case-insensitive ASCII strings. [M1.12]
|
||||
*/
|
||||
public void testPartNameComparaison() throws Exception {
|
||||
String[] partName1 = { "/word/document.xml", "/docProps/core.xml",
|
||||
"/rels/.rels" };
|
||||
String[] partName2 = { "/WORD/DocUment.XML", "/docProps/core.xml",
|
||||
"/rels/.rels" };
|
||||
String[] partName1 = { "/word/document.xml", "/docProps/core.xml", "/rels/.rels" };
|
||||
String[] partName2 = { "/WORD/DocUment.XML", "/docProps/core.xml", "/rels/.rels" };
|
||||
for (int i = 0; i < partName1.length || i < partName2.length; ++i) {
|
||||
PackagePartName p1 = PackagingURIHelper
|
||||
.createPartName(partName1[i]);
|
||||
PackagePartName p2 = PackagingURIHelper
|
||||
.createPartName(partName2[i]);
|
||||
PackagePartName p1 = PackagingURIHelper.createPartName(partName1[i]);
|
||||
PackagePartName p2 = PackagingURIHelper.createPartName(partName2[i]);
|
||||
assertTrue(p1.equals(p2));
|
||||
assertTrue(p1.compareTo(p2) == 0);
|
||||
assertTrue(p1.hashCode() == p2.hashCode());
|
||||
@ -233,18 +227,14 @@ public class TestOPCCompliancePartName extends TestCase {
|
||||
* Part name equivalence is determined by comparing part names as
|
||||
* case-insensitive ASCII strings. [M1.12].
|
||||
*
|
||||
* All the comparaisons MUST FAIL !
|
||||
* All the comparisons MUST FAIL !
|
||||
*/
|
||||
public void testPartNameComparaisonFailure() throws Exception {
|
||||
String[] partName1 = { "/word/document.xml", "/docProps/core.xml",
|
||||
"/rels/.rels" };
|
||||
String[] partName2 = { "/WORD/DocUment.XML2", "/docProp/core.xml",
|
||||
"/rels/rels" };
|
||||
String[] partName1 = { "/word/document.xml", "/docProps/core.xml", "/rels/.rels" };
|
||||
String[] partName2 = { "/WORD/DocUment.XML2", "/docProp/core.xml", "/rels/rels" };
|
||||
for (int i = 0; i < partName1.length || i < partName2.length; ++i) {
|
||||
PackagePartName p1 = PackagingURIHelper
|
||||
.createPartName(partName1[i]);
|
||||
PackagePartName p2 = PackagingURIHelper
|
||||
.createPartName(partName2[i]);
|
||||
PackagePartName p1 = PackagingURIHelper.createPartName(partName1[i]);
|
||||
PackagePartName p2 = PackagingURIHelper.createPartName(partName2[i]);
|
||||
assertFalse(p1.equals(p2));
|
||||
assertFalse(p1.compareTo(p2) == 0);
|
||||
assertFalse(p1.hashCode() == p2.hashCode());
|
||||
|
Loading…
Reference in New Issue
Block a user