Skip to content

Commit

Permalink
Create tests for Method group
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonBaars authored and Stephan202 committed Nov 13, 2021
1 parent 9ff9ef7 commit 581db54
Show file tree
Hide file tree
Showing 3 changed files with 125 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public final class RefasterCheckTest {
"JUnit",
"LongStream",
"MapEntry",
"Method",
"Mockito",
"Multimap",
"Null",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package tech.picnic.errorprone.bugpatterns;

import java.util.stream.Collectors;

final class MethodTemplateTest implements RefasterTemplateTestCase {
String testObjectReturn() {
String var = "Hello!";
return var;
}

byte testByteReturn() {
byte var = Byte.MAX_VALUE;
return var;
}

char testCharacterReturn() {
char var = Character.MAX_VALUE;
return var;
}

short testShortReturn() {
short var = Short.MAX_VALUE;
return var;
}

int testIntegerReturn() {
int var = Integer.MAX_VALUE;
return var;
}

long testLongReturn() {
long var = 349827359L;
return var;
}

float testFloatReturn() {
float var = 4324.347284F;
return var;
}

double testDoubleReturn() {
double var = 3492.34284D;
return var;
}

boolean testBooleanReturn() {
boolean var = true;
return var;
}

String testStuffAboveDoesntMatter() {
System.out.println("Hi");
String var = "Hello!";
return var;
}

String testStuffBelowDoesMatter() {
String var = "Hello!";
System.out.println("Hi");
return var;
}

String testChainedReturn() {
String var =
Stream.of("I", "like", "error-prone", ":-)").collect(Collectors.joining(" ", "", "!"));
return var;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package tech.picnic.errorprone.bugpatterns;

import java.util.stream.Collectors;

final class MethodTemplateTest implements RefasterTemplateTestCase {
String testObjectReturn() {
return "Hello!";
}

byte testByteReturn() {
return Byte.MAX_VALUE;
}

char testCharacterReturn() {
return Character.MAX_VALUE;
}

short testShortReturn() {
return Short.MAX_VALUE;
}

int testIntegerReturn() {
return Integer.MAX_VALUE;
}

long testLongReturn() {
return 349827359L;
}

float testFloatReturn() {
return 4324.347284F;
}

double testDoubleReturn() {
return 3492.34284D;
}

boolean testBooleanReturn() {
return true;
}

String testStuffAboveDoesntMatter() {
System.out.println("Hi");
return "Hello!";
}

String testStuffBelowDoesMatter() {
String var = "Hello!";
System.out.println("Hi");
return var;
}

String testChainedReturn() {
return Stream.of("I", "like", "error-prone", ":-)").collect(Collectors.joining(" ", "", "!"));
}
}

0 comments on commit 581db54

Please sign in to comment.