GoogleJavaFormatStep { public static FormatterStep create(Provisioner provisioner) { return create(defaultVersion(), provisioner); } private  GoogleJavaFormatStep(); static FormatterStep create(Provisioner provisioner); static FormatterStep create(String version, Provisioner provisioner); static FormatterStep create(String version, String style, Provisioner provisioner); static String defaultVersion(); static String defaultStyle();  }
@Test public void behavior18() throws Exception { JreVersion.assume11OrGreater(); FormatterStep step = GoogleJavaFormatStep.create("1.8", TestProvisioner.mavenCentral()); StepHarness.forStep(step) .testResource("java/googlejavaformat/JavaCodeUnformatted.test", "java/googlejavaformat/JavaCodeFormatted18.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 public void behavior() throws Exception { FormatterStep step = GoogleJavaFormatStep.create("1.2", TestProvisioner.mavenCentral()); 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 public void behaviorWithAospStyle() throws Exception { FormatterStep step = GoogleJavaFormatStep.create("1.2", "AOSP", TestProvisioner.mavenCentral()); StepHarness.forStep(step) .testResource("java/googlejavaformat/JavaCodeUnformatted.test", "java/googlejavaformat/JavaCodeFormattedAOSP.test") .testResource("java/googlejavaformat/JavaCodeWithLicenseUnformatted.test", "java/googlejavaformat/JavaCodeWithLicenseFormattedAOSP.test") .testResource("java/googlejavaformat/JavaCodeWithLicensePackageUnformatted.test", "java/googlejavaformat/JavaCodeWithLicensePackageFormattedAOSP.test") .testResource("java/googlejavaformat/JavaCodeWithPackageUnformatted.test", "java/googlejavaformat/JavaCodeWithPackageFormattedAOSP.test"); }
@Test public void equality() throws Exception { new SerializableEqualityTester() { String version = "1.2"; String style = ""; @Override protected void setupTest(API api) { api.areDifferentThan(); version = "1.1"; api.areDifferentThan(); style = "AOSP"; api.areDifferentThan(); } @Override protected FormatterStep create() { String finalVersion = this.version; return GoogleJavaFormatStep.create(finalVersion, style, TestProvisioner.mavenCentral()); } }.testEquals(); }