[
 {name: "Happy Numbers Kata", 
  description: "<h1>Happy Numbers</h1>  <p> Wir wollen uns eine einfache Rechenvorschrift anschauen, die wir auf eine positive Zahl anwenden wollen: <ul>  <li>Die Zahl wird in ihre Ziffern zerlegt (z.B. die Zahl 4711 in 4,7,1,1)</li>  <li>Die Ziffern werden quadriert (in unserem Bsp. 16,49,1,1)</li>  <li>Die Quadrate werden summiert (also 16 + 49 + 1 + 1 = 67)</li> </ul>  Interessanterweise gibt es nur zwei mögliche Szenarien, wenn man diese Vorschrift immer wieder auf das Resultat anwendet.  <ul>  <li>Entweder das Ergebnis wird 1</li>  <li>oder wir kommen in einen Zyklus aus folgenden 8 Zahlen: 4,16,37,58,89,145,42,20</li> </ul>Zahlen, die bei 1 enden, nennt man Happy Numbers. </p>", 
  code:  
    {name: "Happy", 
     code: [
"public class Happy {",
"    ",
"    public static int happyStep(int n) {",
"        return -1;",
"    }",
"",
"    public static boolean isHappy(int n) {",
"        return false;",
"    }",
"",
"    /**",
"     * Zerlegt n in Ziffern. Die einzelnen Ziffern werden in einem Array",
"     * gespeichert. Die Ziffern sind nicht in korrekter Reihenfolge, das spielt",
"     * hier aber keine Rolle, da sowieso summiert wird.",
"     * ",
"     * @param Zahl,",
"     *            die zerlegt werden soll",
"     * @return Array der Ziffern der Eingabezahl",
"     */",
"    public static int[] digits(int n) {",
"        int size = String.valueOf(n).length(); // Arraylaenge bestimmen",
"        int[] result = new int[size];",
"        for (int j = 0; j < result.length; j = j + 1, n = n / 10) {",
"            result[j] = n % 10;",
"        }",
"        return result;",
"    }",
"",
"}"] }, 
  test:  
    {name: "HappyTest", 
     code:[
"import static org.junit.Assert.*;",
"import org.junit.*;",
"",
"public class HappyTest {",
"",
"    @Ignore",
"    @Test",
"    public void happyStep_shouldReturnOne_ifCalledWithOne() {",
"        assertEquals(1, Happy.happyStep(1));",
"    }",
"",
"    @Ignore",
"    @Test",
"    public void happyStep_shouldReturnFour_ifCalledWithTwo() {",
"        assertEquals(4, Happy.happyStep(2));",
"    }",
"",
"    @Ignore",
"    @Test",
"    public void happyStep_shouldReturnNine_ifCalledWithThree() {",
"        assertEquals(9, Happy.happyStep(3));",
"    }",
"",
"    @Ignore",
"    @Test",
"    public void happyStep_shouldReturnFive_ifCalledWithTwelve() {",
"        assertEquals(5, Happy.happyStep(12));",
"    }",
"",
"    @Ignore",
"    @Test",
"    public void happyStep_shouldReturnOne_ifCalledWithTen() {",
"        assertEquals(1, Happy.happyStep(10));",
"    }",
"",
"    @Ignore",
"    @Test",
"    public void oneIsHappy() {",
"        assertEquals(true, Happy.isHappy(1));",
"    }",
"",
"    @Ignore",
"    @Test",
"    public void fourIsNotHappy() {",
"        assertEquals(false, Happy.isHappy(4));",
"    }",
"",
"    @Ignore",
"    @Test",
"    public void fiveIsNotHappy() {",
"        assertEquals(false, Happy.isHappy(5));",
"    }",
"",
"    @Ignore",
"    @Test",
"    public void sevenIsHappy() {",
"        assertEquals(true, Happy.isHappy(7));",
"    }",
"",
"    @Ignore",
"    @Test",
"    public void nineIsHappy() {",
"        assertEquals(false, Happy.isHappy(9));",
"    }",
"",
"    @Ignore",
"    @Test",
"    public void tenIsHappy() {",
"        assertEquals(true, Happy.isHappy(10));",
"    }",
"",
"    @Ignore",
"    @Test",
"    public void elevenIsHappy() {",
"        assertEquals(false, Happy.isHappy(11));",
"    }",
"",
"    @Test",
"    public void digits_shouldReturnASingletonArray_ifCalledWithASingleDigit() {",
"        assertArrayEquals(new int[] { 4 }, Happy.digits(4));",
"    }",
"",
"    @Test",
"    public void digits_shouldReturnAnArrayOfSizeTwo_ifCalledWithATwoDigitNumber() {",
"        assertArrayEquals(new int[] { 2, 4 }, Happy.digits(42));",
"    }",
"",
"    @Test",
"    public void digits_shouldReturnAnArrayOfSizeFour_ifCalledWithAFourDigitNumber() {",
"        assertArrayEquals(new int[] { 1, 1, 7, 4 }, Happy.digits(4711));",
"    }",
"",
"}"]
    },
   babyStepsActivated: false,
   retrospective: false
  }

  ]