Browse Source

Test_Code

master
Alexander Hartung 3 years ago
parent
commit
cf637f0d27
  1. 9
      src/main/java/Arcade64/Arcade64/Code.java
  2. 41
      src/test/java/Arcade64/Arcade64/Test_Code.java

9
src/main/java/Arcade64/Arcade64/Code.java

@ -0,0 +1,9 @@
package Arcade64.Arcade64;
public class Code {
public int rechne(int a, int b) {
return a+b;
}
}

41
src/test/java/Arcade64/Arcade64/Test_Code.java

@ -0,0 +1,41 @@
package Arcade64.Arcade64;
import static org.junit.jupiter.api.Assertions.*;
import java.util.stream.Stream;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
class Test_Code {
@BeforeAll
static void setUpBeforeClass() throws Exception {}
@ParameterizedTest
@MethodSource("testCaserechnen")
void test(String msg, int _a, int _b, int _aspectresult ) {
Code a = new Code();
int resulst = a.rechne(_a, _b);
assertEquals(resulst, _aspectresult, msg);
}
private static Stream<Arguments> testCaserechnen(){
return Stream.of(
Arguments.of("88", 80,8,88),
Arguments.of("45", 22,23, 45),
Arguments.of("96", 8,8,88)
);
}
}
Loading…
Cancel
Save