diff options
author | Curtis D'Entremont | 2007-02-02 18:38:06 +0000 |
---|---|---|
committer | Curtis D'Entremont | 2007-02-02 18:38:06 +0000 |
commit | 262ce44cff2f1357a481691bb0c69c490eafe700 (patch) | |
tree | 1f9622ee7beeb19524d87240e629a4c4e7939fde /org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc | |
parent | cc04d1747e8e01ee5fb59fd52275c5237716c364 (diff) | |
download | eclipse.platform.ua-262ce44cff2f1357a481691bb0c69c490eafe700.tar.gz eclipse.platform.ua-262ce44cff2f1357a481691bb0c69c490eafe700.tar.xz eclipse.platform.ua-262ce44cff2f1357a481691bb0c69c490eafe700.zip |
rework providers API to be less DOM-centric
Diffstat (limited to 'org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc')
-rw-r--r-- | org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/TocAssemblerTest.java | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/TocAssemblerTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/TocAssemblerTest.java index 542f0ef80..9e0eece08 100644 --- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/TocAssemblerTest.java +++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/TocAssemblerTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. + * Copyright (c) 2006, 2007 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -18,12 +18,14 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; -import org.eclipse.help.TocContribution; -import org.eclipse.help.internal.dynamic.NodeWriter; +import org.eclipse.help.internal.dynamic.DocumentWriter; +import org.eclipse.help.internal.toc.Toc; import org.eclipse.help.internal.toc.TocAssembler; +import org.eclipse.help.internal.toc.TocContribution; import org.eclipse.help.internal.toc.TocFile; import org.eclipse.help.internal.toc.TocFileParser; import org.eclipse.ua.tests.plugin.UserAssistanceTestPlugin; +import org.eclipse.ua.tests.util.XMLUtil; public class TocAssemblerTest extends TestCase { @@ -46,7 +48,7 @@ public class TocAssemblerTest extends TestCase { assertEquals(1, contributions.size()); String expected = serialize(result_b_c); String actual = serialize((TocContribution)contributions.get(0)); - assertEquals(expected, actual); + XMLUtil.assertXMLEquals("Assembled TOC did not match expected result", expected, actual); TocContribution a = parser.parse(new TocFile(UserAssistanceTestPlugin.getPluginId(), "data/help/toc/assembler/a.xml", true, "en", null, null)); b = parser.parse(new TocFile(UserAssistanceTestPlugin.getPluginId(), "data/help/toc/assembler/b.xml", true, "en", null, null)); @@ -57,16 +59,14 @@ public class TocAssemblerTest extends TestCase { contributions = new ArrayList(Arrays.asList(new Object[] { a, b, c, d })); contributions = assembler.assemble(contributions); assertEquals(1, contributions.size()); + expected = serialize(result_a_b_c_d); actual = serialize((TocContribution)contributions.get(0)); - assertEquals(expected, actual); + XMLUtil.assertXMLEquals("Assembled TOC did not match expected result", expected, actual); } - private String serialize(TocContribution contribution) { - StringBuffer buf = new StringBuffer(); - String indent = ""; - NodeWriter writer = new NodeWriter(); - writer.write(contribution.getToc(), buf, true, indent, false); - return buf.toString(); + private String serialize(TocContribution contribution) throws Exception { + DocumentWriter writer = new DocumentWriter(); + return new String(writer.writeString((Toc)contribution.getToc(), true)); } } |