Skip to content

Commit 26e9358

Browse files
committed
Test that the IntelliJ settings keep the implementation classpath
The settings' tests wrote and read back the native binary settings but never a classpath, the one list in them. The new test round-trips two jars through IntelliJ's serializer.
1 parent 3fb96d7 commit 26e9358

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

‎open-java-format-idea-plugin/src/test/java/com/palantir/javaformat/intellij/PalantirJavaFormatSettingsTest.java‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
import com.intellij.openapi.util.JDOMUtil;
2020
import com.intellij.util.xmlb.XmlSerializer;
2121
import com.palantir.javaformat.intellij.PalantirJavaFormatSettings.StoredSettings;
22+
import java.net.URI;
2223
import java.nio.file.Path;
24+
import java.util.List;
2325
import java.util.Optional;
2426
import org.intellij.lang.annotations.Language;
2527
import org.junit.jupiter.api.Test;
@@ -60,6 +62,18 @@ void keepsTheNativeBinarySettings() throws Exception {
6062
assertThat(reloaded.getNativeImagePath()).hasValue(Path.of("/opt/open-java-format"));
6163
}
6264

65+
@Test
66+
void keepsTheImplementationClassPath() throws Exception {
67+
var state = new StoredSettings();
68+
state.setImplementationClassPath(List.of("file:/opt/formatter.jar", "file:/opt/guava.jar"));
69+
70+
var reloaded = new PalantirJavaFormatSettings();
71+
reloaded.loadState(deserialize(JDOMUtil.write(XmlSerializer.serialize(state))));
72+
73+
assertThat(reloaded.getImplementationClassPath())
74+
.hasValue(List.of(URI.create("file:/opt/formatter.jar"), URI.create("file:/opt/guava.jar")));
75+
}
76+
6377
@Test
6478
void ignoresTheNativeImageTheGradlePluginUsedToWrite() throws Exception {
6579
// Gradle plugins up to 21.0.1 wrote this for openjavaformat.native.formatter=true. The native binary is a

0 commit comments

Comments
 (0)