Skip to content

Commit 8b10d6a

Browse files
authored
ISSUES-4 improve tests (#16)
1 parent 0e910b8 commit 8b10d6a

File tree

2 files changed

+27
-7
lines changed

2 files changed

+27
-7
lines changed

compiler/src/test/java/io/jbock/simple/processor/BuilderTest.java

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ void builderParameter() {
142142
" @Inject A(@Named(\"a\") String s) {}",
143143
" }",
144144
"",
145-
" @Component",
145+
" @Component(generatePublicMockBuilder = true)",
146146
" public interface AComponent {",
147147
" A getA();",
148148
"",
@@ -175,7 +175,12 @@ void builderParameter() {
175175
" return new Builder_Impl(null);",
176176
" }",
177177
"",
178+
" public static MockBuilder mockBuilder() {",
179+
" return new MockBuilder();",
180+
" }",
181+
"",
178182
" private static final class Builder_Impl implements TestClass.AComponent.Builder {",
183+
" final MockBuilder mockBuilder;",
179184
" String s;",
180185
"",
181186
" @Override",
@@ -190,6 +195,21 @@ void builderParameter() {
190195
" return new TestClass_AComponent_Impl(a);",
191196
" }",
192197
" }",
198+
"",
199+
" public static final class MockBuilder {",
200+
" private TestClass.A a;",
201+
"",
202+
" private MockBuilder() {",
203+
" }",
204+
"",
205+
" public TestClass.AComponent.Builder build() {",
206+
" return new Builder_Impl(this);",
207+
" }",
208+
"",
209+
" public void a(TestClass.A a) {",
210+
" this.a = a;",
211+
" }",
212+
" }",
193213
"}");
194214
}
195215
}

compiler/src/test/java/io/jbock/simple/processor/PrimitiveTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ void providesPrimitive() {
6060
" }",
6161
"",
6262
" @Component",
63-
" interface AComponent {",
63+
" public interface AComponent {",
6464
" A getA();",
6565
"",
6666
" @Component.Factory",
@@ -86,7 +86,7 @@ void providesPrimitive() {
8686
" return a;",
8787
" }",
8888
"",
89-
" static TestClass.AComponent.Factory factory() {",
89+
" public static TestClass.AComponent.Factory factory() {",
9090
" return new Factory_Impl(null);",
9191
" }",
9292
"",
@@ -99,21 +99,21 @@ void providesPrimitive() {
9999
" }",
100100
" }",
101101
"",
102-
" static final class MockBuilder {",
102+
" public static final class MockBuilder {",
103103
" private int b;",
104104
" private boolean b_isSet;",
105105
" private TestClass.A a;",
106106
"",
107-
" TestClass.AComponent.Factory build() {",
107+
" public TestClass.AComponent.Factory build() {",
108108
" return new Factory_Impl(this);",
109109
" }",
110110
"",
111-
" void b(int b) {",
111+
" public void b(int b) {",
112112
" this.b = b;",
113113
" this.b_isSet = true;",
114114
" }",
115115
"",
116-
" void a(TestClass.A a) {",
116+
" public void a(TestClass.A a) {",
117117
" this.a = a;",
118118
" }",
119119
" }",

0 commit comments

Comments
 (0)