Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.StringReader;
import java.io.StringWriter;
import java.io.Writer;
Expand All @@ -37,15 +38,13 @@
import org.apache.maven.api.services.xml.XmlWriterRequest;
import org.apache.maven.impl.model.DefaultModelProcessor;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledOnOs;
import org.junit.jupiter.api.io.TempDir;

import static java.util.UUID.randomUUID;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.AssertionsForClassTypes.assertThatExceptionOfType;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.condition.OS.WINDOWS;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

Expand Down Expand Up @@ -252,19 +251,17 @@ void locateExistingPomWithFilePathShouldReturnSameFileIfRegularFile() throws IOE
}

@Test
@DisabledOnOs(
value = WINDOWS,
disabledReason = "windows related issue https://github.com/apache/maven/pull/2312#issuecomment-2876291814")
void readFromUrlParsesPluginDescriptorCorrectly() throws Exception {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the builder took (and still takes) an input stream not a URL. So this is renamed accordingly.
If it is expected that the test was using a Url then the test was already incorrectly implemented.

void readFromInputStreamParsesPluginDescriptorCorrectly() throws Exception {
Path xmlFile = tempDir.resolve("plugin.xml");
Files.write(xmlFile, SAMPLE_PLUGIN_XML.getBytes());
PluginDescriptor descriptor = defaultPluginXmlFactory.read(XmlReaderRequest.builder()
.inputStream(xmlFile.toUri().toURL().openStream())
.build());
assertThat(descriptor.getName()).isEqualTo(NAME);
assertThat(descriptor.getGroupId()).isEqualTo("org.example");
assertThat(descriptor.getArtifactId()).isEqualTo("sample-plugin");
assertThat(descriptor.getVersion()).isEqualTo("1.0.0");
try (InputStream is = xmlFile.toUri().toURL().openStream()) {
PluginDescriptor descriptor = defaultPluginXmlFactory.read(
XmlReaderRequest.builder().inputStream(is).build());
Comment on lines +257 to +259
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the fix (everything else is whitespace)

assertThat(descriptor.getName()).isEqualTo(NAME);
assertThat(descriptor.getGroupId()).isEqualTo("org.example");
assertThat(descriptor.getArtifactId()).isEqualTo("sample-plugin");
assertThat(descriptor.getVersion()).isEqualTo("1.0.0");
}
}

@Test
Expand Down
Loading