File tree Expand file tree Collapse file tree 3 files changed +5
-29
lines changed
junit-platform-engine/src/main/java/org/junit/platform/engine
junit-platform-launcher/src/main/java/org/junit/platform/launcher
platform-tests/src/test/java/org/junit/platform/commons/support/conversion Expand file tree Collapse file tree 3 files changed +5
-29
lines changed Original file line number Diff line number Diff line change @@ -132,10 +132,7 @@ public String getName() {
132132
133133 @ Override
134134 public boolean equals (Object obj ) {
135- if (obj instanceof TestTag that ) {
136- return Objects .equals (this .name , that .name );
137- }
138- return false ;
135+ return (obj instanceof TestTag that && Objects .equals (this .name , that .name ));
139136 }
140137
141138 @ Override
Original file line number Diff line number Diff line change @@ -251,10 +251,7 @@ public Set<TestTag> getTags() {
251251
252252 @ Override
253253 public boolean equals (Object obj ) {
254- if (obj instanceof TestIdentifier that ) {
255- return Objects .equals (this .uniqueId , that .uniqueId );
256- }
257- return false ;
254+ return (obj instanceof TestIdentifier that && Objects .equals (this .uniqueId , that .uniqueId ));
258255 }
259256
260257 @ Override
Original file line number Diff line number Diff line change @@ -158,13 +158,7 @@ Book nonStaticFactory(String title) {
158158
159159 @ Override
160160 public boolean equals (Object obj ) {
161- if (this == obj ) {
162- return true ;
163- }
164- if (!(obj instanceof Book that )) {
165- return false ;
166- }
167- return Objects .equals (this .title , that .title );
161+ return (this == obj ) || (obj instanceof Book that && Objects .equals (this .title , that .title ));
168162 }
169163
170164 @ Override
@@ -184,13 +178,7 @@ static class Journal {
184178
185179 @ Override
186180 public boolean equals (Object obj ) {
187- if (this == obj ) {
188- return true ;
189- }
190- if (!(obj instanceof Journal that )) {
191- return false ;
192- }
193- return Objects .equals (this .title , that .title );
181+ return (this == obj ) || (obj instanceof Journal that && Objects .equals (this .title , that .title ));
194182 }
195183
196184 @ Override
@@ -218,13 +206,7 @@ static Newspaper of(String title) {
218206
219207 @ Override
220208 public boolean equals (Object obj ) {
221- if (this == obj ) {
222- return true ;
223- }
224- if (!(obj instanceof Newspaper that )) {
225- return false ;
226- }
227- return Objects .equals (this .title , that .title );
209+ return (this == obj ) || (obj instanceof Newspaper that && Objects .equals (this .title , that .title ));
228210 }
229211
230212 @ Override
You can’t perform that action at this time.
0 commit comments