@@ -57,14 +57,14 @@ class DefaultPluginXmlFactoryReadWriteTest {
5757 </plugin>
5858 """ ;
5959
60- private final DefaultPluginXmlFactory sut = new DefaultPluginXmlFactory ();
60+ private final DefaultPluginXmlFactory defaultPluginXmlFactory = new DefaultPluginXmlFactory ();
6161
6262 @ TempDir
6363 Path tempDir ;
6464
6565 @ Test
6666 void readFromInputStreamParsesPluginDescriptorCorrectly () {
67- PluginDescriptor descriptor = sut .read (XmlReaderRequest .builder ()
67+ PluginDescriptor descriptor = defaultPluginXmlFactory .read (XmlReaderRequest .builder ()
6868 .inputStream (new ByteArrayInputStream (SAMPLE_PLUGIN_XML .getBytes ()))
6969 .build ());
7070 assertEquals ("Sample Plugin" , descriptor .getName ());
@@ -74,10 +74,10 @@ void readFromInputStreamParsesPluginDescriptorCorrectly() {
7474 }
7575
7676 @ Test
77- void readFromReaderParsesPluginDescriptorCorrectly () {
77+ void testParsePlugin () {
7878 assertEquals (
7979 "Sample Plugin" ,
80- sut .read (XmlReaderRequest .builder ()
80+ defaultPluginXmlFactory .read (XmlReaderRequest .builder ()
8181 .reader (new StringReader (SAMPLE_PLUGIN_XML ))
8282 .build ())
8383 .getName ());
@@ -89,20 +89,20 @@ void readFromPathParsesPluginDescriptorCorrectly() throws Exception {
8989 Files .write (xmlFile , SAMPLE_PLUGIN_XML .getBytes ());
9090 assertEquals (
9191 "Sample Plugin" ,
92- sut .read (XmlReaderRequest .builder ().path (xmlFile ).build ()).getName ());
92+ defaultPluginXmlFactory .read (XmlReaderRequest .builder ().path (xmlFile ).build ()).getName ());
9393 }
9494
9595 @ Test
9696 void readWithNoInputThrowsIllegalArgumentException () {
9797 assertThrows (
9898 IllegalArgumentException .class ,
99- () -> sut .read (XmlReaderRequest .builder ().build ()));
99+ () -> defaultPluginXmlFactory .read (XmlReaderRequest .builder ().build ()));
100100 }
101101
102102 @ Test
103103 void writeToWriterGeneratesValidXml () {
104104 StringWriter writer = new StringWriter ();
105- sut .write (XmlWriterRequest .<PluginDescriptor >builder ()
105+ defaultPluginXmlFactory .write (XmlWriterRequest .<PluginDescriptor >builder ()
106106 .writer (writer )
107107 .content (PluginDescriptor .newBuilder ()
108108 .name ("Sample Plugin" )
@@ -119,7 +119,7 @@ void writeToWriterGeneratesValidXml() {
119119 @ Test
120120 void writeToOutputStreamGeneratesValidXml () {
121121 ByteArrayOutputStream outputStream = new ByteArrayOutputStream ();
122- sut .write (XmlWriterRequest .<PluginDescriptor >builder ()
122+ defaultPluginXmlFactory .write (XmlWriterRequest .<PluginDescriptor >builder ()
123123 .outputStream (outputStream )
124124 .content (PluginDescriptor .newBuilder ().name ("Sample Plugin" ).build ())
125125 .build ());
@@ -129,7 +129,7 @@ void writeToOutputStreamGeneratesValidXml() {
129129 @ Test
130130 void writeToPathGeneratesValidXmlFile () throws Exception {
131131 Path xmlFile = tempDir .resolve ("output-plugin.xml" );
132- sut .write (XmlWriterRequest .<PluginDescriptor >builder ()
132+ defaultPluginXmlFactory .write (XmlWriterRequest .<PluginDescriptor >builder ()
133133 .path (xmlFile )
134134 .content (PluginDescriptor .newBuilder ().name ("Sample Plugin" ).build ())
135135 .build ());
@@ -138,7 +138,7 @@ void writeToPathGeneratesValidXmlFile() throws Exception {
138138
139139 @ Test
140140 void fromXmlStringParsesValidXml () {
141- PluginDescriptor descriptor = sut .fromXmlString (SAMPLE_PLUGIN_XML );
141+ PluginDescriptor descriptor = defaultPluginXmlFactory .fromXmlString (SAMPLE_PLUGIN_XML );
142142 assertEquals ("Sample Plugin" , descriptor .getName ());
143143 assertEquals ("org.example" , descriptor .getGroupId ());
144144 assertEquals ("sample-plugin" , descriptor .getArtifactId ());
@@ -147,7 +147,7 @@ void fromXmlStringParsesValidXml() {
147147
148148 @ Test
149149 void toXmlStringGeneratesValidXml () {
150- String xml = sut .toXmlString (PluginDescriptor .newBuilder ()
150+ String xml = defaultPluginXmlFactory .toXmlString (PluginDescriptor .newBuilder ()
151151 .name ("Sample Plugin" )
152152 .groupId ("org.example" )
153153 .artifactId ("sample-plugin" )
@@ -186,7 +186,7 @@ void staticToXmlGeneratesValidXml() {
186186 void writeWithFailingWriterThrowsXmlWriterException () {
187187 XmlWriterException exception = assertThrows (
188188 XmlWriterException .class ,
189- () -> sut .write (XmlWriterRequest .<PluginDescriptor >builder ()
189+ () -> defaultPluginXmlFactory .write (XmlWriterRequest .<PluginDescriptor >builder ()
190190 .writer (new Writer () {
191191 @ Override
192192 public void write (char [] cbuf , int off , int len ) {
@@ -213,7 +213,7 @@ void writeWithNoTargetThrowsIllegalArgumentException() {
213213 "writer, outputStream or path must be non null" ,
214214 assertThrows (
215215 IllegalArgumentException .class ,
216- () -> sut .write (XmlWriterRequest .<PluginDescriptor >builder ()
216+ () -> defaultPluginXmlFactory .write (XmlWriterRequest .<PluginDescriptor >builder ()
217217 .content (PluginDescriptor .newBuilder ()
218218 .name ("No Output Plugin" )
219219 .build ())
@@ -225,7 +225,7 @@ void writeWithNoTargetThrowsIllegalArgumentException() {
225225 void readMalformedXmlThrowsXmlReaderException () {
226226 XmlReaderException exception = assertThrows (
227227 XmlReaderException .class ,
228- () -> sut .read (XmlReaderRequest .builder ()
228+ () -> defaultPluginXmlFactory .read (XmlReaderRequest .builder ()
229229 .inputStream (new ByteArrayInputStream ("<plugin><name>Broken Plugin" .getBytes ()))
230230 .build ()));
231231 assertTrue (exception .getMessage ().contains ("Unable to read plugin" ));
@@ -243,7 +243,7 @@ void locateExistingPomWithFilePathShouldReturnSameFileIfRegularFile() throws IOE
243243 void readFromUrlParsesPluginDescriptorCorrectly () throws Exception {
244244 Path xmlFile = tempDir .resolve ("plugin.xml" );
245245 Files .write (xmlFile , SAMPLE_PLUGIN_XML .getBytes ());
246- PluginDescriptor descriptor = sut .read (XmlReaderRequest .builder ()
246+ PluginDescriptor descriptor = defaultPluginXmlFactory .read (XmlReaderRequest .builder ()
247247 .inputStream (xmlFile .toUri ().toURL ().openStream ())
248248 .build ());
249249 assertEquals ("Sample Plugin" , descriptor .getName ());
0 commit comments