From 2e235259f66976a1b0152b19e784e24fcdcbab78 Mon Sep 17 00:00:00 2001 From: Michail Plushnikov Date: Sun, 1 Nov 2020 10:47:02 +0100 Subject: [PATCH] [lombok] IDEA-254198 added more tests GitOrigin-RevId: 6a842d278ae1ff28cdca504d82e299f0b68fd990 --- .../builder/BuilderWithXArgsConstructor.java | 117 ++++++++++++++++++ .../builder/BuilderWithXArgsConstructor.java | 19 +++ 2 files changed, 136 insertions(+) diff --git a/plugins/lombok/testData/after/builder/BuilderWithXArgsConstructor.java b/plugins/lombok/testData/after/builder/BuilderWithXArgsConstructor.java index 239a5453f0ce..fa9b19a13017 100644 --- a/plugins/lombok/testData/after/builder/BuilderWithXArgsConstructor.java +++ b/plugins/lombok/testData/after/builder/BuilderWithXArgsConstructor.java @@ -39,3 +39,120 @@ public class BuilderWithXArgsConstructor { } } } +class BuilderWithAllArgsConstructorPrivate { + private int someProperty; + + @Generated + public static BuilderWithAllArgsConstructorPrivate.BuilderWithAllArgsConstructorPrivateBuilder builder() { + return new BuilderWithAllArgsConstructorPrivateBuilder(); + } + + @Generated + private BuilderWithAllArgsConstructorPrivate(int someProperty) { + this.someProperty = someProperty; + } + + @Generated + public static class BuilderWithAllArgsConstructorPrivateBuilder { + @Generated + private int someProperty; + + @Generated + BuilderWithAllArgsConstructorPrivateBuilder() { + } + + @Generated + public BuilderWithAllArgsConstructorPrivate.BuilderWithAllArgsConstructorPrivateBuilder someProperty(int someProperty) { + this.someProperty = someProperty; + return this; + } + + @Generated + public BuilderWithAllArgsConstructorPrivate build() { + return new BuilderWithAllArgsConstructorPrivate(someProperty); + } + + @Generated + public String toString() { + return "BuilderWithAllArgsConstructorPrivate.BuilderWithAllArgsConstructorPrivateBuilder(someProperty=" + this.someProperty + ")"; + } + } +} +class BuilderWithReqArgsConstructor { + private final int someProperty; + + @Generated + public static BuilderWithReqArgsConstructor.BuilderWithReqArgsConstructorBuilder builder() { + return new BuilderWithReqArgsConstructorBuilder(); + } + + @Generated + public BuilderWithReqArgsConstructor(int someProperty) { + this.someProperty = someProperty; + } + + @Generated + public static class BuilderWithReqArgsConstructorBuilder { + @Generated + private int someProperty; + + @Generated + BuilderWithReqArgsConstructorBuilder() { + } + + @Generated + public BuilderWithReqArgsConstructor.BuilderWithReqArgsConstructorBuilder someProperty(int someProperty) { + this.someProperty = someProperty; + return this; + } + + @Generated + public BuilderWithReqArgsConstructor build() { + return new BuilderWithReqArgsConstructor(someProperty); + } + + @Generated + public String toString() { + return "BuilderWithReqArgsConstructor.BuilderWithReqArgsConstructorBuilder(someProperty=" + this.someProperty + ")"; + } + } +} +class BuilderWithReqArgsConstructorPrivate { + private final int someProperty; + + @Generated + public static BuilderWithReqArgsConstructorPrivate.BuilderWithReqArgsConstructorPrivateBuilder builder() { + return new BuilderWithReqArgsConstructorPrivateBuilder(); + } + + @Generated + private BuilderWithReqArgsConstructorPrivate(int someProperty) { + this.someProperty = someProperty; + } + + @Generated + public static class BuilderWithReqArgsConstructorPrivateBuilder { + @Generated + private int someProperty; + + @Generated + BuilderWithReqArgsConstructorPrivateBuilder() { + } + + @Generated + public BuilderWithReqArgsConstructorPrivate.BuilderWithReqArgsConstructorPrivateBuilder someProperty(int someProperty) { + this.someProperty = someProperty; + return this; + } + + @Generated + public BuilderWithReqArgsConstructorPrivate build() { + return new BuilderWithReqArgsConstructorPrivate(someProperty); + } + + @Generated + public String toString() { + return "BuilderWithReqArgsConstructorPrivate.BuilderWithReqArgsConstructorPrivateBuilder(someProperty=" + this.someProperty + ")"; + } + } +} diff --git a/plugins/lombok/testData/before/builder/BuilderWithXArgsConstructor.java b/plugins/lombok/testData/before/builder/BuilderWithXArgsConstructor.java index e92565cbd116..47eeda57ecf4 100644 --- a/plugins/lombok/testData/before/builder/BuilderWithXArgsConstructor.java +++ b/plugins/lombok/testData/before/builder/BuilderWithXArgsConstructor.java @@ -1,5 +1,6 @@ import lombok.AccessLevel; import lombok.AllArgsConstructor; +import lombok.RequiredArgsConstructor; import lombok.Builder; @AllArgsConstructor(access = AccessLevel.PUBLIC) @@ -7,3 +8,21 @@ import lombok.Builder; public class BuilderWithXArgsConstructor { private int someProperty; } + +@AllArgsConstructor(access = AccessLevel.PRIVATE) +@Builder +class BuilderWithAllArgsConstructorPrivate { + private int someProperty; +} + +@RequiredArgsConstructor(access = AccessLevel.PUBLIC) +@Builder +class BuilderWithReqArgsConstructor { + private final int someProperty; +} + +@RequiredArgsConstructor(access = AccessLevel.PRIVATE) +@Builder +class BuilderWithReqArgsConstructorPrivate { + private final int someProperty; +}