@@ -0,0 +1,17 @@ | |||
<component name="libraryTable"> | |||
<library name="junit.jupiter" type="repository"> | |||
<properties maven-id="org.junit.jupiter:junit-jupiter:5.8.1" /> | |||
<CLASSES> | |||
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter/5.8.1/junit-jupiter-5.8.1.jar!/" /> | |||
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-api/5.8.1/junit-jupiter-api-5.8.1.jar!/" /> | |||
<root url="jar://$MAVEN_REPOSITORY$/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar!/" /> | |||
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-commons/1.8.1/junit-platform-commons-1.8.1.jar!/" /> | |||
<root url="jar://$MAVEN_REPOSITORY$/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2.jar!/" /> | |||
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-params/5.8.1/junit-jupiter-params-5.8.1.jar!/" /> | |||
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-engine/5.8.1/junit-jupiter-engine-5.8.1.jar!/" /> | |||
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-engine/1.8.1/junit-platform-engine-1.8.1.jar!/" /> | |||
</CLASSES> | |||
<JAVADOC /> | |||
<SOURCES /> | |||
</library> | |||
</component> |
@@ -3,9 +3,12 @@ | |||
<component name="NewModuleRootManager" inherit-compiler-output="true"> | |||
<exclude-output /> | |||
<content url="file://$MODULE_DIR$"> | |||
<sourceFolder url="file://$MODULE_DIR$/TestTriangle" isTestSource="true" /> | |||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> | |||
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" /> | |||
</content> | |||
<orderEntry type="inheritedJdk" /> | |||
<orderEntry type="sourceFolder" forTests="false" /> | |||
<orderEntry type="library" name="junit.jupiter" level="project" /> | |||
</component> | |||
</module> |
@@ -0,0 +1,18 @@ | |||
import org.junit.jupiter.api.Test; | |||
import static org.junit.jupiter.api.Assertions.*; | |||
class TriangleCheckerTest { | |||
@Test | |||
void checkTriangle() { | |||
float a = 3; | |||
float b = 4; | |||
float c = 5; | |||
TriangleChecker.TriangleType result = TriangleChecker.checkTriangle(a, b, c); | |||
assertEquals(TriangleChecker.TriangleType.NORMAL, result, "Normales Dreieck"); | |||
} | |||
} |
@@ -2,10 +2,9 @@ package praktikum01; | |||
public class Zahlenfilter { | |||
static int temp = 0; | |||
static int wiederholen; | |||
public static void main(String[] args) { | |||
int wiederholen; | |||
if( args.length == 0){ | |||
wiederholen= 200; | |||
@@ -13,31 +12,30 @@ public class Zahlenfilter { | |||
else { | |||
wiederholen= Integer.parseInt(args[0]); | |||
} | |||
printNumbers(); | |||
System.out.println(wiederholen); | |||
System.out.println(args.length); | |||
for (int i = 0; i < wiederholen ; i++ ){ | |||
System.out.println("Zahl |" +i+"|"); | |||
//System.out.println(args.length); | |||
} | |||
//DURCH 5 TEILBAR---------------------------------------------------// | |||
private static void printNumbers(){ | |||
for (int i=1; i <=wiederholen; i++) | |||
if (i % 5== 0){ | |||
System.out.println(" '-----> ["+i+"] ist durch 5 teilbar!"); | |||
} | |||
if(filter(i)) | |||
System.out.println(i); | |||
} | |||
//AM ENDE EINE 9---------------------------------------------------// | |||
if (i %10 ==9){ | |||
System.out.println(" '-----> [" +i+"] ist endet auf 9!"); | |||
} | |||
public static boolean filter(int i){ | |||
return !(checkDivisibleBy5(i) || checkEndsWith9(i) || checkSumDivisibleBy3(i, i-1)); | |||
} | |||
//ADDIERT DURCH 3 TEILBAR -----------------------------------------// | |||
if ((i + temp) % 3 ==0){ | |||
int ergebnis = i +temp; | |||
System.out.println(" '-----> ["+i+"] und [" +temp+ "] addiert ergeben [" +ergebnis + "] und [" +ergebnis+ "] ist durch 3 teilbar"); | |||
} | |||
//ZUWEISUNG TEMP WERT----------------------------------------------// | |||
temp = i; | |||
public static boolean checkDivisibleBy5(int i){ | |||
return (i % 5== 0); | |||
} | |||
public static boolean checkEndsWith9(int i){ | |||
return (i %10 ==9); | |||
} | |||
} | |||
public static boolean checkSumDivisibleBy3(int i, int j) { | |||
return ((i + j) % 3 ==0); | |||
} | |||
} |
@@ -0,0 +1,46 @@ | |||
package praktikum01; | |||
import org.junit.jupiter.api.Test; | |||
import static org.junit.jupiter.api.Assertions.*; | |||
class ZahlenfilterTest { | |||
@Test | |||
void filter() { | |||
assertTrue(Zahlenfilter.filter(7)); | |||
// Testfall 2: Zahl, die die Filterkriterien nicht erfüllt (z.B. 15 - teilbar durch 5) | |||
assertFalse(Zahlenfilter.filter(15)); | |||
} | |||
@Test | |||
void checkDivisibleBy5() { | |||
assertTrue(Zahlenfilter.checkDivisibleBy5(10)); | |||
// Testfall 2: Zahl, die nicht durch 5 teilbar ist | |||
assertFalse(Zahlenfilter.checkDivisibleBy5(7)); | |||
} | |||
@Test | |||
void checkEndsWith9() { | |||
assertTrue(Zahlenfilter.checkEndsWith9(29)); | |||
// Testfall 2: Zahl, die nicht auf 9 endet | |||
assertFalse(Zahlenfilter.checkEndsWith9(20)); | |||
} | |||
@Test | |||
void checkSumDivisibleBy3() { | |||
assertTrue(Zahlenfilter.checkSumDivisibleBy3(4, 2)); | |||
// Testfall 2: Summe von zwei Zahlen, die nicht durch 3 teilbar ist (z.B. 4 + 3 = 7) | |||
assertFalse(Zahlenfilter.checkSumDivisibleBy3(4, 3)); | |||
} | |||
} |