Test fixes

This commit is contained in:
dragonmacher 2025-03-11 14:27:00 -04:00
parent 73d29e3488
commit 04f1cca0ab

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -35,6 +35,8 @@ import help.validator.model.*;
public class OverlayHelpTreeTest { public class OverlayHelpTreeTest {
private int sortCounter;
@Test @Test
public void testSourceTOCFileThatDependsUponPreBuiltHelp() { public void testSourceTOCFileThatDependsUponPreBuiltHelp() {
// //
@ -43,24 +45,24 @@ public class OverlayHelpTreeTest {
// in a help <TOCITEM> that lives inside of a pre-built jar file. // in a help <TOCITEM> that lives inside of a pre-built jar file.
// //
/* /*
Example makeup we will create: Example makeup we will create:
PreBuild_TOC.xml PreBuild_TOC.xml
<tocitem id="root" target="fake"> <tocitem id="root" target="fake">
<tocitem id="child_1" target="fake" /> <tocitem id="child_1" target="fake" />
</tocitem> </tocitem>
TOC_Source.xml TOC_Source.xml
<tocref id="root"> <tocref id="root">
<tocref="child_1"> <tocref="child_1">
<tocdef id="child_2" target="fake" /> <tocdef id="child_2" target="fake" />
</tocref> </tocref>
</tocref> </tocref>
*/ */
TOCItemExternal root = externalItem("root"); TOCItemExternal root = externalItem("root");
@ -92,26 +94,26 @@ public class OverlayHelpTreeTest {
public void testSourceTOCFileThatDependsAnotherTOCSourceFile() { public void testSourceTOCFileThatDependsAnotherTOCSourceFile() {
/* /*
The first source file defines attributes that the second file references. The first source file defines attributes that the second file references.
Example makeup we will create: Example makeup we will create:
TOC_Source.xml TOC_Source.xml
<tocdef id="root" target="fake"> <tocdef id="root" target="fake">
<tocdef id="child_1" target="fake" /> <tocdef id="child_1" target="fake" />
</tocdef> </tocdef>
Another TOC_Source.xml Another TOC_Source.xml
<tocref id="root"> <tocref id="root">
<tocref="child_1"> <tocref="child_1">
<tocdef id="child_2" target="fake" /> <tocdef id="child_2" target="fake" />
</tocref> </tocref>
</tocref> </tocref>
*/ */
Path toc_1 = Paths.get("/fake/path_1/TOC_Source.xml"); Path toc_1 = Paths.get("/fake/path_1/TOC_Source.xml");
@ -147,34 +149,34 @@ public class OverlayHelpTreeTest {
// in a help <TOCITEM> that lives inside of multiple pre-built jar files. // in a help <TOCITEM> that lives inside of multiple pre-built jar files.
// //
/* /*
Example makeup we will create: Example makeup we will create:
PreBuild_TOC.xml PreBuild_TOC.xml
<tocitem id="root" target="fake"> <tocitem id="root" target="fake">
<tocitem id="child_1" target="fake"> <tocitem id="child_1" target="fake">
<tocitem="prebuilt_a_child" target="fake" /> <tocitem="prebuilt_a_child" target="fake" />
</tocitem> </tocitem>
</tocitem> </tocitem>
Another PreBuild_TOC.xml Another PreBuild_TOC.xml
<tocitem id="root" target="fake"> <tocitem id="root" target="fake">
<tocitem id="child_1" target="fake"> <tocitem id="child_1" target="fake">
<tocitem="prebuilt_b_child" target="fake" /> <tocitem="prebuilt_b_child" target="fake" />
</tocitem> </tocitem>
</tocitem> </tocitem>
TOC_Source.xml TOC_Source.xml
<tocref id="root"> <tocref id="root">
<tocref="child_1"> <tocref="child_1">
<tocdef id="child_2" target="fake" /> <tocdef id="child_2" target="fake" />
</tocref> </tocref>
</tocref> </tocref>
*/ */
TOCItemExternal root_a = externalItem("root"); TOCItemExternal root_a = externalItem("root");
@ -212,44 +214,43 @@ public class OverlayHelpTreeTest {
// note: prebuilt_a_child and prebuilt_b_child don't get output, since they do not have // note: prebuilt_a_child and prebuilt_b_child don't get output, since they do not have
// the same TOC file ID as the help file being processed (in other words, they don't // the same TOC file ID as the help file being processed (in other words, they don't
// live in the TOC_Source.xml being processes, so they are not part of the output).
} }
@Test @Test
public void testSourceTOCFileThatHasNodeWithSameTextAttributeAsOneOfItsExternalModluleDependencies() { public void testSourceTOCFileThatHasNodeWithSameTextAttributeAsOneOfItsExternalModluleDependencies() {
/* /*
The first source file defines attributes that the second file references. Both files The first source file defines attributes that the second file references. Both files
will have multiple nodes that coincidentally share 'text' attribute values. will have multiple nodes that coincidentally share 'text' attribute values.
Note: the 'id' attributes have to be unique; the 'text' attributes do not have to be unique Note: the 'id' attributes have to be unique; the 'text' attributes do not have to be unique
Example makeup we will create: Example makeup we will create:
PreBuild_TOC.xml PreBuild_TOC.xml
<tocitem id="root" target="fake"> <tocitem id="root" target="fake">
<tocitem id="child_1_1" text="Child 1" target="fake" /> <tocitem id="child_1_1" text="Child 1" target="fake" />
</tocitem> </tocitem>
Another PreBuild_TOC.xml Another PreBuild_TOC.xml
<tocitem id="root" target="fake"> <tocitem id="root" target="fake">
<tocitem id="child_2_1" text=Child 1" target="fake" /> <tocitem id="child_2_1" text=Child 1" target="fake" />
<tocitem id="child_2_2" text=Child 2" target="fake" /> <tocitem id="child_2_2" text=Child 2" target="fake" />
</tocitem> </tocitem>
Another TOC_Source.xml Another TOC_Source.xml
<tocref id="root"> <tocref id="root">
<tocref="child_1_1"> <tocref="child_1_1">
<tocdef id="child_2_1a" text="Child 1a" target="fake" /> <tocdef id="child_2_1a" text="Child 1a" target="fake" />
</tocref> </tocref>
<tocdef id="child_3_2" text="Child 2" target="fake" /> <tocdef id="child_3_2" text="Child 2" target="fake" />
</tocref> </tocref>
*/ */
TOCItemExternal root_a = externalItem("root"); TOCItemExternal root_a = externalItem("root");
@ -288,7 +289,7 @@ public class OverlayHelpTreeTest {
// note: prebuilt_a_child and prebuilt_b_child don't get output, since they do not have // note: prebuilt_a_child and prebuilt_b_child don't get output, since they do not have
// the same TOC file ID as the help file being processed (in other words, they don't // the same TOC file ID as the help file being processed (in other words, they don't
// live in the TOC_Source.xml being processes, so they are not part of the output). // live in the TOC_Source.xml being processed, so they are not part of the output).
} }
//================================================================================================== //==================================================================================================
@ -327,7 +328,7 @@ public class OverlayHelpTreeTest {
private TOCItemDefinition tocdef(TOCItem parent, String ID, String text, Path tocSourceFile) { private TOCItemDefinition tocdef(TOCItem parent, String ID, String text, Path tocSourceFile) {
String target = "fake"; String target = "fake";
String sort = ""; String sort = Integer.toString(++sortCounter);
int line = 1; int line = 1;
return new TOCItemDefinition(parent, tocSourceFile, ID, text, target, sort, line); return new TOCItemDefinition(parent, tocSourceFile, ID, text, target, sort, line);
} }
@ -351,7 +352,7 @@ public class OverlayHelpTreeTest {
private TOCItemExternal externalItem(TOCItem parent, String ID, String text) { private TOCItemExternal externalItem(TOCItem parent, String ID, String text) {
Path tocFile = Paths.get("/fake/path_1/PreBuild_TOC.xml"); Path tocFile = Paths.get("/fake/path_1/PreBuild_TOC.xml");
String target = "fake"; String target = "fake";
String sort = ""; String sort = Integer.toString(++sortCounter);
int line = 1; int line = 1;
return new TOCItemExternal(parent, tocFile, ID, text, target, sort, line); return new TOCItemExternal(parent, tocFile, ID, text, target, sort, line);
} }