Commit 9ee875a6 authored by Verena Strobel's avatar Verena Strobel
Browse files

Jetzt ist auch der JUnitTest wirklich passend

parent 1c6ed36a
......@@ -5,12 +5,7 @@ import java.util.List;
public class HappyNumberCalculator {
public HappyNumberCalculator()
{
// erstellt einen neuen Rechner
}
public boolean isHappyNumber(int x)
public static boolean isHappyNumber(int x)
{
List<Integer> ziffern = new ArrayList<Integer>();
......@@ -39,7 +34,6 @@ public class HappyNumberCalculator {
if(ziffernQuadratSummiert == 1)
{
System.out.print("ziffernQuadratSummiert ist endlich 1, es handelt sich um eine HappyNumber!");
return true;
}
......
package happyNumber;
import static org.junit.Assert.*;
import org.junit.Test;
public class happyNumbersTest {
@Test
public void test() {
assertTrue(HappyNumberCalculator.isHappyNumber(1));
assertTrue(HappyNumberCalculator.isHappyNumber(100000000));
assertTrue(HappyNumberCalculator.isHappyNumber(10));
assertTrue(HappyNumberCalculator.isHappyNumber(19));
assertFalse(HappyNumberCalculator.isHappyNumber(2));
assertFalse(HappyNumberCalculator.isHappyNumber(200));
assertFalse(HappyNumberCalculator.isHappyNumber(80));
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment