Skip to content

Commit

Permalink
add tests for custom group artifact
Browse files Browse the repository at this point in the history
  • Loading branch information
figroc committed Sep 26, 2021
1 parent 5aab9d9 commit 6757a42
Showing 1 changed file with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,16 @@ void behaviorWithReflowLongStrings() throws Exception {
}
}

@Test
void behaviorWithCustomGroupArtifact() throws Exception {
FormatterStep step = GoogleJavaFormatStep.create(GoogleJavaFormatStep.defaultGroupArtifact(), "1.2", GoogleJavaFormatStep.defaultStyle(), TestProvisioner.mavenCentral(), false);
StepHarness.forStep(step)
.testResource("java/googlejavaformat/JavaCodeUnformatted.test", "java/googlejavaformat/JavaCodeFormatted.test")
.testResource("java/googlejavaformat/JavaCodeWithLicenseUnformatted.test", "java/googlejavaformat/JavaCodeWithLicenseFormatted.test")
.testResource("java/googlejavaformat/JavaCodeWithLicensePackageUnformatted.test", "java/googlejavaformat/JavaCodeWithLicensePackageFormatted.test")
.testResource("java/googlejavaformat/JavaCodeWithPackageUnformatted.test", "java/googlejavaformat/JavaCodeWithPackageFormatted.test");
}

@Test
void equality() throws Exception {
new SerializableEqualityTester() {
Expand Down Expand Up @@ -113,6 +123,30 @@ protected FormatterStep create() {
}.testEquals();
}

@Test
void equalityGroupArtifact() throws Exception {
new SerializableEqualityTester() {
String groupArtifact = GoogleJavaFormatStep.defaultGroupArtifact();
String version = "1.11.0";
String style = "";
boolean reflowLongStrings = false;

@Override
protected void setupTest(API api) {
// same version == same
api.areDifferentThan();
// change the groupArtifact, and it's different
groupArtifact = "io.opil:google-java-format";
api.areDifferentThan();
}

@Override
protected FormatterStep create() {
return GoogleJavaFormatStep.create(groupArtifact, version, style, TestProvisioner.mavenCentral(), reflowLongStrings);
}
}.testEquals();
}

@Test
void fixWindowsBugForGfj1Point1() {
fixWindowsBugTestcase("");
Expand Down

0 comments on commit 6757a42

Please sign in to comment.