Skip to content

Commit 0614f94

Browse files
committed
Remove obsolete and time consuming Java 7 issue #51 regression test
1 parent e3ca715 commit 0614f94

1 file changed

Lines changed: 0 additions & 37 deletions

File tree

src/test/java/org/codehaus/plexus/util/xml/PrettyPrintXMLWriterTest.java

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,7 @@
1818

1919
import javax.swing.text.html.HTML.Tag;
2020

21-
import java.io.File;
22-
import java.io.IOException;
23-
import java.io.OutputStreamWriter;
2421
import java.io.StringWriter;
25-
import java.nio.charset.StandardCharsets;
26-
import java.nio.file.Files;
2722
import java.util.NoSuchElementException;
2823

2924
import org.codehaus.plexus.util.StringUtils;
@@ -32,7 +27,6 @@
3227
import org.junit.jupiter.api.Test;
3328

3429
import static org.junit.jupiter.api.Assertions.assertEquals;
35-
import static org.junit.jupiter.api.Assertions.assertTrue;
3630
import static org.junit.jupiter.api.Assertions.fail;
3731

3832
/**
@@ -142,37 +136,6 @@ void testendElementAlreadyClosed() {
142136
}
143137
}
144138

145-
/**
146-
* Issue #51: https://github.com/codehaus-plexus/plexus-utils/issues/51 Purpose: test if concatenation string
147-
* optimization bug is present. Target environment: Java 7 (u79 and u80 verified) running on Windows. Detection
148-
* strategy: Tries to build a big XML file (~750MB size) and with many nested tags to force the JVM to trigger the
149-
* concatenation string optimization bug that throws a NoSuchElementException when calling endElement() method.
150-
*
151-
* @throws java.io.IOException if an I/O error occurs
152-
*/
153-
@Test
154-
void issue51DetectJava7ConcatenationBug() throws IOException {
155-
File dir = new File("target/test-xml");
156-
if (!dir.exists()) {
157-
assertTrue(dir.mkdir(), "cannot create directory test-xml");
158-
}
159-
File xmlFile = new File(dir, "test-issue-51.xml");
160-
try (OutputStreamWriter osw =
161-
new OutputStreamWriter(Files.newOutputStream(xmlFile.toPath()), StandardCharsets.UTF_8); ) {
162-
writer = new PrettyPrintXMLWriter(osw);
163-
int iterations = 20000;
164-
for (int i = 0; i < iterations; ++i) {
165-
writer.startElement(Tag.DIV.toString() + i);
166-
writer.addAttribute("class", "someattribute");
167-
}
168-
for (int i = 0; i < iterations; ++i) {
169-
writer.endElement(); // closes Tag.DIV + i
170-
}
171-
} catch (NoSuchElementException e) {
172-
fail("Should not throw a NoSuchElementException");
173-
}
174-
}
175-
176139
private void writeXhtmlHead(XMLWriter writer) {
177140
writer.startElement(Tag.HEAD.toString());
178141
writer.startElement(Tag.TITLE.toString());

0 commit comments

Comments
 (0)