EndWithNewlineStep { public static FormatterStep create() { return FormatterStep.create("endWithNewline", EndWithNewlineStep.class, unused -> EndWithNewlineStep::format); } private  EndWithNewlineStep(); static FormatterStep create();  }
@Test public void behavior() throws Exception { StepHarness harness = StepHarness.forStep(EndWithNewlineStep.create()); harness.test("", "\n"); harness.test("\n\n\n\n", "\n"); harness.test("line", "line\n"); harness.test("line\nline\n\n\n\n", "line\nline\n"); harness.testUnaffected("\n"); harness.testUnaffected("line\n"); }
@Test public void equality() throws Exception { new SerializableEqualityTester() { @Override protected void setupTest(API api) { api.areDifferentThan(); } @Override protected FormatterStep create() { return EndWithNewlineStep.create(); } }.testEquals(); }