mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-13 22:16:11 +00:00
Added tests for Setter, Cleanup and NonNull
This commit is contained in:
1 parent
0b36718d20
commit
be20f7a118
15 files changed
+317
-1
No files matched your search
@@ -0,0 +1,10 @@
|
||||
class Cleanup {
|
||||
void test() throws Exception {
|
||||
Object o = "Hello World!";
|
||||
try {
|
||||
System.out.println(o);
|
||||
} finally {
|
||||
o.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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() {
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
class Cleanup {
|
||||
void test() throws Exception {
|
||||
@lombok.Cleanup("toString") Object o = "Hello World!";
|
||||
System.out.println(o);
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
import lombok.Getter;
|
||||
|
||||
class Getter {
|
||||
@lombok.Getter int i;
|
||||
@Getter int foo;
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
class NonNullPlain {
|
||||
@lombok.Getter
|
||||
@lombok.Setter
|
||||
@lombok.NonNull
|
||||
@lombok.Getter int i;
|
||||
|
||||
@lombok.Getter
|
||||
@lombok.Setter
|
||||
@lombok.NonNull
|
||||
String s;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import lombok.Setter;
|
||||
class Setter {
|
||||
@lombok.Setter int i;
|
||||
@Setter int foo;
|
||||
}
|
||||
Reference in new issue
Block a user