Skip to content

Commit fa74605

Browse files
committed
Remove unnecessary public qualifiers
The EscapingXmlStreamWriter and XmlReportData are package private. So their methods do not need to be public. This makes it easier to see which parts of the API are intended to be used outside this library.
1 parent 6f6acc7 commit fa74605

File tree

3 files changed

+23
-23
lines changed

3 files changed

+23
-23
lines changed

java/src/main/java/io/cucumber/junitxmlformatter/EscapingXmlStreamWriter.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class EscapingXmlStreamWriter implements AutoCloseable {
1111

1212
private final XMLStreamWriter writer;
1313

14-
public EscapingXmlStreamWriter(XMLStreamWriter writer) {
14+
EscapingXmlStreamWriter(XMLStreamWriter writer) {
1515
this.writer = Objects.requireNonNull(writer);
1616
}
1717

@@ -20,41 +20,41 @@ public void close() throws XMLStreamException {
2020
writer.close();
2121
}
2222

23-
public void writeStartDocument(String encoding, String version) throws XMLStreamException {
23+
void writeStartDocument(String encoding, String version) throws XMLStreamException {
2424
writer.writeStartDocument(encoding, version);
2525
}
2626

27-
public void newLine() throws XMLStreamException {
27+
void writeNewLine() throws XMLStreamException {
2828
writer.writeCharacters("\n");
2929
}
3030

31-
public void writeStartElement(String localName) throws XMLStreamException {
31+
void writeStartElement(String localName) throws XMLStreamException {
3232
writer.writeStartElement(localName);
3333
}
3434

35-
public void writeEndElement() throws XMLStreamException {
35+
void writeEndElement() throws XMLStreamException {
3636
writer.writeEndElement();
3737
}
3838

39-
public void writeEndDocument() throws XMLStreamException {
39+
void writeEndDocument() throws XMLStreamException {
4040
writer.writeEndDocument();
4141
}
4242

43-
public void flush() throws XMLStreamException {
43+
void flush() throws XMLStreamException {
4444
writer.flush();
4545
}
4646

47-
public void writeEmptyElement(String localName) throws XMLStreamException {
47+
void writeEmptyElement(String localName) throws XMLStreamException {
4848
writer.writeEmptyElement(localName);
4949
}
5050

51-
public void writeAttribute(String localName, String value) throws XMLStreamException {
51+
void writeAttribute(String localName, String value) throws XMLStreamException {
5252
writer.writeAttribute(localName, escapeIllegalChars(value));
5353
}
5454

5555
private static final Pattern CDATA_TERMINATOR_SPLIT = Pattern.compile("(?<=]])(?=>)");
5656

57-
public void writeCData(String data) throws XMLStreamException {
57+
void writeCData(String data) throws XMLStreamException {
5858
// https://stackoverflow.com/questions/223652/is-there-a-way-to-escape-a-cdata-end-token-in-xml
5959
for (String part : CDATA_TERMINATOR_SPLIT.split(data)) {
6060
// see https://www.w3.org/TR/xml/#dt-cdsection

java/src/main/java/io/cucumber/junitxmlformatter/XmlReportData.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class XmlReportData {
3535

3636
private static final long MILLIS_PER_SECOND = SECONDS.toMillis(1L);
3737

38-
public XmlReportData(NamingStrategy namingStrategy) {
38+
XmlReportData(NamingStrategy namingStrategy) {
3939
this.namingStrategy = namingStrategy;
4040
}
4141

@@ -77,7 +77,7 @@ String getPickleName(TestCaseStarted testCaseStarted) {
7777
return query.findNameOf(pickle, namingStrategy);
7878
}
7979

80-
public String getFeatureName(TestCaseStarted testCaseStarted) {
80+
String getFeatureName(TestCaseStarted testCaseStarted) {
8181
return query.findFeatureBy(testCaseStarted)
8282
.map(Feature::getName)
8383
.orElseThrow(() -> new IllegalStateException("No feature for " + testCaseStarted));

java/src/main/java/io/cucumber/junitxmlformatter/XmlReportWriter.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ void writeXmlReport(Writer out) throws XMLStreamException {
3030
XMLOutputFactory factory = XMLOutputFactory.newInstance();
3131
EscapingXmlStreamWriter writer = new EscapingXmlStreamWriter(factory.createXMLStreamWriter(out));
3232
writer.writeStartDocument("UTF-8", "1.0");
33-
writer.newLine();
33+
writer.writeNewLine();
3434
writeTestsuite(writer);
3535
writer.writeEndDocument();
3636
writer.flush();
@@ -39,14 +39,14 @@ void writeXmlReport(Writer out) throws XMLStreamException {
3939
private void writeTestsuite(EscapingXmlStreamWriter writer) throws XMLStreamException {
4040
writer.writeStartElement("testsuite");
4141
writeSuiteAttributes(writer);
42-
writer.newLine();
42+
writer.writeNewLine();
4343

4444
for (TestCaseStarted testCaseStarted : data.getAllTestCaseStarted()) {
4545
writeTestcase(writer, testCaseStarted);
4646
}
4747

4848
writer.writeEndElement();
49-
writer.newLine();
49+
writer.writeNewLine();
5050
}
5151

5252
private void writeSuiteAttributes(EscapingXmlStreamWriter writer) throws XMLStreamException {
@@ -75,11 +75,11 @@ private static EnumSet<TestStepResultStatus> createNotPassedNotSkippedSet() {
7575
private void writeTestcase(EscapingXmlStreamWriter writer, TestCaseStarted testCaseStarted) throws XMLStreamException {
7676
writer.writeStartElement("testcase");
7777
writeTestCaseAttributes(writer, testCaseStarted);
78-
writer.newLine();
78+
writer.writeNewLine();
7979
writeNonPassedElement(writer, testCaseStarted);
8080
writeStepAndResultList(writer, testCaseStarted);
8181
writer.writeEndElement();
82-
writer.newLine();
82+
writer.writeNewLine();
8383
}
8484

8585
private void writeTestCaseAttributes(EscapingXmlStreamWriter writer, TestCaseStarted testCaseStarted) throws XMLStreamException {
@@ -117,22 +117,22 @@ private void writeNonPassedElement(EscapingXmlStreamWriter writer, TestCaseStart
117117
}
118118
if (hasMessageOrStackTrace) {
119119
if (exceptionStackTrace.isPresent()) {
120-
writer.newLine();
120+
writer.writeNewLine();
121121
writer.writeCData(exceptionStackTrace.get());
122-
writer.newLine();
122+
writer.writeNewLine();
123123
} else {
124124
// Fall back to message for older implementations
125125
// that put the stack trace in the message
126-
writer.newLine();
126+
writer.writeNewLine();
127127
writer.writeCData(message.get());
128-
writer.newLine();
128+
writer.writeNewLine();
129129
}
130130
}
131131

132132
if (hasMessageOrStackTrace) {
133133
writer.writeEndElement();
134134
}
135-
writer.newLine();
135+
writer.writeNewLine();
136136
}
137137

138138
private void writeStepAndResultList(EscapingXmlStreamWriter writer, TestCaseStarted testCaseStarted) throws XMLStreamException {
@@ -143,7 +143,7 @@ private void writeStepAndResultList(EscapingXmlStreamWriter writer, TestCaseStar
143143
writer.writeStartElement("system-out");
144144
writer.writeCData(createStepResultList(results));
145145
writer.writeEndElement();
146-
writer.newLine();
146+
writer.writeNewLine();
147147
}
148148

149149
private static String createStepResultList(List<Map.Entry<String, String>> results) {

0 commit comments

Comments
 (0)