From 9639bc2ff466e94f629d81ff00d8cab654f3ab19 Mon Sep 17 00:00:00 2001 From: Roel Spilker Date: Tue, 3 Dec 2013 21:17:05 +0100 Subject: [pretty] Make the tests work with the new delombok formatting options. --- src/delombok/lombok/delombok/Delombok.java | 2 +- test/pretty/resource/after/TryWithResources.java | 2 +- .../after-delombok/ValInTryWithResources.java | 2 +- .../resource/after-delombok/ValWithLabel.java | 3 +- .../resource/before/ConstructorsWithAccessors.java | 8 ++--- .../resource/before/ExtensionMethodPlain.java | 36 +++++++++++----------- 6 files changed, 27 insertions(+), 26 deletions(-) diff --git a/src/delombok/lombok/delombok/Delombok.java b/src/delombok/lombok/delombok/Delombok.java index fb1098b5..23400771 100644 --- a/src/delombok/lombok/delombok/Delombok.java +++ b/src/delombok/lombok/delombok/Delombok.java @@ -79,7 +79,7 @@ public class Delombok { private String classpath, sourcepath, bootclasspath; private LinkedHashMap fileToBase = new LinkedHashMap(); private List filesToParse = new ArrayList(); - private Map formatPrefs = null; + private Map formatPrefs = new HashMap(); /** If null, output to standard out. */ private File output = null; diff --git a/test/pretty/resource/after/TryWithResources.java b/test/pretty/resource/after/TryWithResources.java index 1a8b82e2..eb622f2c 100644 --- a/test/pretty/resource/after/TryWithResources.java +++ b/test/pretty/resource/after/TryWithResources.java @@ -2,7 +2,7 @@ import java.io.PrintWriter; public class TryWithResources { { - try (final PrintWriter pw = new PrintWriter(System.out);) { + try (PrintWriter pw = new PrintWriter(System.out)) { pw.println(); } } diff --git a/test/transform/resource/after-delombok/ValInTryWithResources.java b/test/transform/resource/after-delombok/ValInTryWithResources.java index 73f8d1a2..9aae99a2 100644 --- a/test/transform/resource/after-delombok/ValInTryWithResources.java +++ b/test/transform/resource/after-delombok/ValInTryWithResources.java @@ -2,7 +2,7 @@ import java.io.IOException; public class ValInTryWithResources { public void whyTryInsteadOfCleanup() throws IOException { - try (final java.io.InputStream in = getClass().getResourceAsStream("ValInTryWithResources.class");) { + try (java.io.InputStream in = getClass().getResourceAsStream("ValInTryWithResources.class")) { final java.io.InputStream i = in; final int j = in.read(); } diff --git a/test/transform/resource/after-delombok/ValWithLabel.java b/test/transform/resource/after-delombok/ValWithLabel.java index 82cd4ed7..4d8eabf2 100644 --- a/test/transform/resource/after-delombok/ValWithLabel.java +++ b/test/transform/resource/after-delombok/ValWithLabel.java @@ -1,6 +1,7 @@ public class ValWithLabel { { - LABEL: for (final java.lang.String x : new String[0]) { + LABEL: + for (final java.lang.String x : new String[0]) { if (x.toLowerCase() == null) { continue LABEL; } diff --git a/test/transform/resource/before/ConstructorsWithAccessors.java b/test/transform/resource/before/ConstructorsWithAccessors.java index d242317d..e5d2939f 100644 --- a/test/transform/resource/before/ConstructorsWithAccessors.java +++ b/test/transform/resource/before/ConstructorsWithAccessors.java @@ -1,6 +1,6 @@ @lombok.AllArgsConstructor @lombok.experimental.Accessors(prefix={"p", "_"}) class ConstructorsWithAccessors { - int plower; - int pUpper; - int _huh; - int __huh2; + int plower; + int pUpper; + int _huh; + int __huh2; } diff --git a/test/transform/resource/before/ExtensionMethodPlain.java b/test/transform/resource/before/ExtensionMethodPlain.java index 8c2f369d..f954d01f 100644 --- a/test/transform/resource/before/ExtensionMethodPlain.java +++ b/test/transform/resource/before/ExtensionMethodPlain.java @@ -2,22 +2,22 @@ import lombok.experimental.ExtensionMethod; @ExtensionMethod({java.util.Arrays.class, ExtensionMethodPlain.Extensions.class}) class ExtensionMethodPlain { - public String test() { - int[] intArray = {5, 3, 8, 2}; - intArray.sort(); - - String iAmNull = null; - return iAmNull.or("hELlO, WORlD!".toTitleCase()); - } - - static class Extensions { - public static T or(T obj, T ifNull) { - return obj != null ? obj : ifNull; - } - - public static String toTitleCase(String in) { - if (in.isEmpty()) return in; - return "" + Character.toTitleCase(in.charAt(0)) + in.substring(1).toLowerCase(); - } - } + public String test() { + int[] intArray = {5, 3, 8, 2}; + intArray.sort(); + + String iAmNull = null; + return iAmNull.or("hELlO, WORlD!".toTitleCase()); + } + + static class Extensions { + public static T or(T obj, T ifNull) { + return obj != null ? obj : ifNull; + } + + public static String toTitleCase(String in) { + if (in.isEmpty()) return in; + return "" + Character.toTitleCase(in.charAt(0)) + in.substring(1).toLowerCase(); + } + } } -- cgit