You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: core/src/test/java/com/google/errorprone/bugpatterns/checkreturnvalue/CanIgnoreReturnValueSuggesterTest.java
+34
Original file line number
Diff line number
Diff line change
@@ -56,6 +56,36 @@ public void simpleCase() {
56
56
.doTest();
57
57
}
58
58
59
+
@Test
60
+
publicvoidb362106953_returnThis() {
61
+
helper
62
+
.addInputLines(
63
+
"Client.java",
64
+
"package com.google.frobber;",
65
+
"public final class Client {",
66
+
" public Client setName(String name) {",
67
+
" return this;",
68
+
" }",
69
+
"}")
70
+
.expectUnchanged()
71
+
.doTest();
72
+
}
73
+
74
+
@Test
75
+
publicvoidb362106953_returnParam() {
76
+
helper
77
+
.addInputLines(
78
+
"Client.java",
79
+
"package com.google.frobber;",
80
+
"public final class Client {",
81
+
" public String setName(String name) {",
82
+
" return name;",
83
+
" }",
84
+
"}")
85
+
.expectUnchanged()
86
+
.doTest();
87
+
}
88
+
59
89
@Test
60
90
publicvoidparenthesizedCastThis() {
61
91
helper
@@ -92,6 +122,7 @@ public void returnsInputParam() {
92
122
"package com.google.frobber;",
93
123
"public final class Client {",
94
124
" public String method(String name) {",
125
+
" System.out.println(name);",
95
126
" return name;",
96
127
" }",
97
128
"}")
@@ -102,6 +133,7 @@ public void returnsInputParam() {
102
133
"public final class Client {",
103
134
" @CanIgnoreReturnValue",
104
135
" public String method(String name) {",
136
+
" System.out.println(name);",
105
137
" return name;",
106
138
" }",
107
139
"}")
@@ -157,6 +189,7 @@ public void returnInputParams_multipleParams() {
157
189
"package com.google.frobber;",
158
190
"public final class ReturnInputParam {",
159
191
" public static StringBuilder append(StringBuilder input, String name) {",
192
+
" input.append(name);",
160
193
" return input;",
161
194
" }",
162
195
"}")
@@ -167,6 +200,7 @@ public void returnInputParams_multipleParams() {
167
200
"public final class ReturnInputParam {",
168
201
" @CanIgnoreReturnValue",
169
202
" public static StringBuilder append(StringBuilder input, String name) {",
0 commit comments