diff options
author | Roel Spilker <r.spilker@gmail.com> | 2009-11-29 01:07:53 +0100 |
---|---|---|
committer | Roel Spilker <r.spilker@gmail.com> | 2009-11-29 01:07:53 +0100 |
commit | be20f7a1180e4aa3d699d89c756c0c07e2eba1a7 (patch) | |
tree | 8ff277160a99fc7f2f6a11fdea60980979019195 | |
parent | 0b36718d20bf149b4bdd9b2be88bf68055311b9a (diff) | |
download | lombok-be20f7a1180e4aa3d699d89c756c0c07e2eba1a7.tar.gz lombok-be20f7a1180e4aa3d699d89c756c0c07e2eba1a7.tar.bz2 lombok-be20f7a1180e4aa3d699d89c756c0c07e2eba1a7.zip |
Added tests for Setter, Cleanup and NonNull
-rw-r--r-- | test/lombok/resource/after/CleanupName.java | 10 | ||||
-rw-r--r-- | test/lombok/resource/after/CleanupPlain.java | 18 | ||||
-rw-r--r-- | test/lombok/resource/after/GetterAlreadyExists.java | 66 | ||||
-rw-r--r-- | test/lombok/resource/after/NonNullPlain.java | 25 | ||||
-rw-r--r-- | test/lombok/resource/after/SetterAccessLevel.java | 19 | ||||
-rw-r--r-- | test/lombok/resource/after/SetterAlreadyExists.java | 35 | ||||
-rw-r--r-- | test/lombok/resource/after/SetterPlain.java | 10 | ||||
-rw-r--r-- | test/lombok/resource/before/CleanupName.java | 6 | ||||
-rw-r--r-- | test/lombok/resource/before/CleanupPlain.java | 11 | ||||
-rw-r--r-- | test/lombok/resource/before/GetterAlreadyExists.java | 54 | ||||
-rw-r--r-- | test/lombok/resource/before/GetterPlain.java | 1 | ||||
-rw-r--r-- | test/lombok/resource/before/NonNullPlain.java | 11 | ||||
-rw-r--r-- | test/lombok/resource/before/SetterAccessLevel.java | 12 | ||||
-rw-r--r-- | test/lombok/resource/before/SetterAlreadyExists.java | 35 | ||||
-rw-r--r-- | test/lombok/resource/before/SetterPlain.java | 5 |
15 files changed, 317 insertions, 1 deletions
diff --git a/test/lombok/resource/after/CleanupName.java b/test/lombok/resource/after/CleanupName.java new file mode 100644 index 00000000..26997372 --- /dev/null +++ b/test/lombok/resource/after/CleanupName.java @@ -0,0 +1,10 @@ +class Cleanup { + void test() throws Exception { + Object o = "Hello World!"; + try { + System.out.println(o); + } finally { + o.toString(); + } + } +} diff --git a/test/lombok/resource/after/CleanupPlain.java b/test/lombok/resource/after/CleanupPlain.java new file mode 100644 index 00000000..25c66ced --- /dev/null +++ b/test/lombok/resource/after/CleanupPlain.java @@ -0,0 +1,18 @@ +import java.io.*; +class Cleanup { + void test() throws Exception { + InputStream in = new FileInputStream("in"); + try { + OutputStream out = new FileOutputStream("out"); + try { + if (in.markSupported()) { + out.flush(); + } + } finally { + out.close(); + } + } finally { + in.close(); + } + } +} diff --git a/test/lombok/resource/after/GetterAlreadyExists.java b/test/lombok/resource/after/GetterAlreadyExists.java index 152cb372..fce1ba41 100644 --- a/test/lombok/resource/after/GetterAlreadyExists.java +++ b/test/lombok/resource/after/GetterAlreadyExists.java @@ -63,4 +63,70 @@ class Getter9 { boolean getFoo() { return false; } +} +class Getter10 { + boolean foo; + static boolean hasFoo() { + return false; + } +} +class Getter11 { + boolean foo; + static boolean isFoo() { + return false; + } +} +class Getter12 { + boolean foo; + static boolean getFoo() { + return false; + } +} +class Getter13 { + String foo; + static boolean hasFoo() { + return false; + } + public String getFoo() { + return foo; + } +} +class Getter14 { + String foo; + static boolean isFoo() { + return false; + } + public String getFoo() { + return foo; + } +} +class Getter15 { + String foo; + static boolean getFoo() { + return false; + } +} +class Getter16 { + String foo; + static String hasFoo() { + return false; + } + public String getFoo() { + return foo; + } +} +class Getter17 { + String foo; + static String isFoo() { + return false; + } + public String getFoo() { + return foo; + } +} +class Getter18 { + String foo; + static String getFoo() { + return false; + } }
\ No newline at end of file diff --git a/test/lombok/resource/after/NonNullPlain.java b/test/lombok/resource/after/NonNullPlain.java new file mode 100644 index 00000000..2d7ebb4f --- /dev/null +++ b/test/lombok/resource/after/NonNullPlain.java @@ -0,0 +1,25 @@ +class NonNullPlain { + @lombok.NonNull + int i; + @lombok.NonNull + String s; + + @lombok.NonNull + public int getI() { + return i; + } + + public void setI(@lombok.NonNull final int i) { + this.i = i; + } + + @lombok.NonNull + public String getS() { + return s; + } + + public void setS(@lombok.NonNull final String s) { + if (s == null) throw new java.lang.NullPointerException("s"); + this.s = s; + } +} diff --git a/test/lombok/resource/after/SetterAccessLevel.java b/test/lombok/resource/after/SetterAccessLevel.java new file mode 100644 index 00000000..95179bac --- /dev/null +++ b/test/lombok/resource/after/SetterAccessLevel.java @@ -0,0 +1,19 @@ +class Setter { + boolean isNone; + boolean isPrivate; + boolean isPackage; + boolean isProtected; + boolean isPublic; + private void setIsPrivate(final boolean isPrivate) { + this.isPrivate = isPrivate; + } + void setIsPackage(final boolean isPackage) { + this.isPackage = isPackage; + } + protected void setIsProtected(final boolean isProtected) { + this.isProtected = isProtected; + } + public void setIsPublic(final boolean isPublic) { + this.isPublic = isPublic; + } +} diff --git a/test/lombok/resource/after/SetterAlreadyExists.java b/test/lombok/resource/after/SetterAlreadyExists.java new file mode 100644 index 00000000..e4992b29 --- /dev/null +++ b/test/lombok/resource/after/SetterAlreadyExists.java @@ -0,0 +1,35 @@ +class Setter1 { + boolean foo; + void setFoo(boolean foo) { + } +} +class Setter2 { + boolean foo; + void setFoo(String foo) { + } +} +class Setter3 { + String foo; + void setFoo(boolean foo) { + } +} +class Setter4 { + String foo; + void setFoo(String foo) { + } +} +class Setter5 { + String foo; + void setFoo() { + } +} +class Setter6 { + String foo; + void setFoo(String foo, int x) { + } +} +class Setter7 { + String foo; + static void setFoo() { + } +} diff --git a/test/lombok/resource/after/SetterPlain.java b/test/lombok/resource/after/SetterPlain.java new file mode 100644 index 00000000..2570365c --- /dev/null +++ b/test/lombok/resource/after/SetterPlain.java @@ -0,0 +1,10 @@ +class Setter { + int i; + int foo; + public void setI(final int i) { + this.i = i; + } + public void setFoo(final int foo) { + this.foo = foo; + } +}
\ No newline at end of file diff --git a/test/lombok/resource/before/CleanupName.java b/test/lombok/resource/before/CleanupName.java new file mode 100644 index 00000000..0d253f1e --- /dev/null +++ b/test/lombok/resource/before/CleanupName.java @@ -0,0 +1,6 @@ +class Cleanup { + void test() throws Exception { + @lombok.Cleanup("toString") Object o = "Hello World!"; + System.out.println(o); + } +}
\ No newline at end of file diff --git a/test/lombok/resource/before/CleanupPlain.java b/test/lombok/resource/before/CleanupPlain.java new file mode 100644 index 00000000..f463b152 --- /dev/null +++ b/test/lombok/resource/before/CleanupPlain.java @@ -0,0 +1,11 @@ +import lombok.Cleanup; +import java.io.*; +class Cleanup { + void test() throws Exception { + @lombok.Cleanup InputStream in = new FileInputStream("in"); + @Cleanup OutputStream out = new FileOutputStream("out"); + if (in.markSupported()) { + out.flush(); + } + } +}
\ No newline at end of file diff --git a/test/lombok/resource/before/GetterAlreadyExists.java b/test/lombok/resource/before/GetterAlreadyExists.java index 3a22ed36..93b77dc1 100644 --- a/test/lombok/resource/before/GetterAlreadyExists.java +++ b/test/lombok/resource/before/GetterAlreadyExists.java @@ -51,4 +51,58 @@ class Getter9 { boolean getFoo() { return false; } +} +class Getter10 { + @lombok.Getter boolean foo; + static boolean hasFoo() { + return false; + } +} +class Getter11 { + @lombok.Getter boolean foo; + static boolean isFoo() { + return false; + } +} +class Getter12 { + @lombok.Getter boolean foo; + static boolean getFoo() { + return false; + } +} +class Getter13 { + @lombok.Getter String foo; + static boolean hasFoo() { + return false; + } +} +class Getter14 { + @lombok.Getter String foo; + static boolean isFoo() { + return false; + } +} +class Getter15 { + @lombok.Getter String foo; + static boolean getFoo() { + return false; + } +} +class Getter16 { + @lombok.Getter String foo; + static String hasFoo() { + return false; + } +} +class Getter17 { + @lombok.Getter String foo; + static String isFoo() { + return false; + } +} +class Getter18 { + @lombok.Getter String foo; + static String getFoo() { + return false; + } }
\ No newline at end of file diff --git a/test/lombok/resource/before/GetterPlain.java b/test/lombok/resource/before/GetterPlain.java index e3baf5ae..e6018972 100644 --- a/test/lombok/resource/before/GetterPlain.java +++ b/test/lombok/resource/before/GetterPlain.java @@ -1,5 +1,4 @@ import lombok.Getter; - class Getter { @lombok.Getter int i; @Getter int foo; diff --git a/test/lombok/resource/before/NonNullPlain.java b/test/lombok/resource/before/NonNullPlain.java new file mode 100644 index 00000000..eef64b2f --- /dev/null +++ b/test/lombok/resource/before/NonNullPlain.java @@ -0,0 +1,11 @@ +class NonNullPlain { + @lombok.Getter + @lombok.Setter + @lombok.NonNull + @lombok.Getter int i; + + @lombok.Getter + @lombok.Setter + @lombok.NonNull + String s; +}
\ No newline at end of file diff --git a/test/lombok/resource/before/SetterAccessLevel.java b/test/lombok/resource/before/SetterAccessLevel.java new file mode 100644 index 00000000..767341ef --- /dev/null +++ b/test/lombok/resource/before/SetterAccessLevel.java @@ -0,0 +1,12 @@ +class Setter { + @lombok.Setter(lombok.AccessLevel.NONE) + boolean isNone; + @lombok.Setter(lombok.AccessLevel.PRIVATE) + boolean isPrivate; + @lombok.Setter(lombok.AccessLevel.PACKAGE) + boolean isPackage; + @lombok.Setter(lombok.AccessLevel.PROTECTED) + boolean isProtected; + @lombok.Setter(lombok.AccessLevel.PUBLIC) + boolean isPublic; +} diff --git a/test/lombok/resource/before/SetterAlreadyExists.java b/test/lombok/resource/before/SetterAlreadyExists.java new file mode 100644 index 00000000..a7a94123 --- /dev/null +++ b/test/lombok/resource/before/SetterAlreadyExists.java @@ -0,0 +1,35 @@ +class Setter1 { + @lombok.Setter boolean foo; + void setFoo(boolean foo) { + } +} +class Setter2 { + @lombok.Setter boolean foo; + void setFoo(String foo) { + } +} +class Setter3 { + @lombok.Setter String foo; + void setFoo(boolean foo) { + } +} +class Setter4 { + @lombok.Setter String foo; + void setFoo(String foo) { + } +} +class Setter5 { + @lombok.Setter String foo; + void setFoo() { + } +} +class Setter6 { + @lombok.Setter String foo; + void setFoo(String foo, int x) { + } +} +class Setter7 { + @lombok.Setter String foo; + static void setFoo() { + } +} diff --git a/test/lombok/resource/before/SetterPlain.java b/test/lombok/resource/before/SetterPlain.java new file mode 100644 index 00000000..482b5e05 --- /dev/null +++ b/test/lombok/resource/before/SetterPlain.java @@ -0,0 +1,5 @@ +import lombok.Setter; +class Setter { + @lombok.Setter int i; + @Setter int foo; +}
\ No newline at end of file |