@Test @Points("85.3") public void tehtyjenPunnitustenMaaraMuistissa() { assertEquals( "Does the method totalWeightsMeasured() work? " + "At the beginning no weights measured! Check code\n" + "ref = Reformatory(); " + "System.out.println( ref.totalWeightsMeasured() )", 0, totalWeightsMeasured(ref)); ref.weight(pekka); assertEquals( "Does the method totalWeightsMeasured() work? " + "It should return how many times the method weight() has been called " + "Check code\n" + "ref = Reformatory(); " + "h1 = new Person(\"Pekka\", 33, 175, 78); " + "ref.weight(h1);" + "System.out.println( ref.totalWeightsMeasured() )", 1, totalWeightsMeasured(ref)); Person mikko = new Person("Mikko", 0, 52, 4); ref.weight(mikko); assertEquals( "Does the method totalWeightsMeasured() work? " + "It should return how many times the method weight() has been called " + "Check code\n" + "ref = Reformatory(); " + "h1 = new Person(\"Pekka\", 33, 175, 78); " + "h2 = new Person(\"Mikko\", 0, 52, 4); " + "ref.weight(h1);" + "ref.weight(h2);" + "System.out.println( ref.totalWeightsMeasured() )", 2, totalWeightsMeasured(ref)); ref.weight(mikko); ref.weight(pekka); ref.weight(pekka); assertEquals( "Does the method totalWeightsMeasured() work? " + "It should return how many times the method weight() has been called " + "Check code\n" + "ref = Reformatory(); " + "h1 = new Person(\"Pekka\", 33, 175, 78); " + "h2 = new Person(\"Mikko\", 0, 52, 4); " + "ref.weight(h1);" + "ref.weight(h2);" + "ref.weight(h2);" + "ref.weight(h1);" + "ref.weight(h1);" + "System.out.println( ref.totalWeightsMeasured() )", 5, totalWeightsMeasured(ref)); }
@Test @Points("85.1") public void test2() { assertEquals( "check code: ref = Reformatory(); " + "h = new Person(\"Pekka\", 33, 175, 78); " + "System.out.println( ref.weight(h) )", pekka.getWeight(), ref.weight(pekka)); for (int i = 0; i < 5; i++) { int paino = 60 + arpa.nextInt(60); Person mikko = new Person("Mikko", 45, 181, paino); assertEquals( "check code: ref = Reformatory(); " + "h = new Person(\"Mikko\", 45, 181, " + paino + "); " + "System.out.println( ref.weight(h) )", mikko.getWeight(), ref.weight(mikko)); } }
@Test @Points("85.2") public void test5() { int odotettu = pekka.getWeight() + 1; feed(ref, pekka); assertEquals( "Feeding should increase the weight by one kilo. Check code: \n" + "ref = Reformatory(); " + "h = new Person(\"Pekka\", 33, 175, 78); " + "ref.feed(h); " + "System.out.println( h.getWeight() )", odotettu, pekka.getWeight()); assertEquals( "Feeding should increase the weight by one kilo. Check code: \n" + "ref = Reformatory(); " + "h = new Person(\"Pekka\", 33, 175, 78); " + "ref.feed(h); " + "System.out.println( ref.getWeight(h) )", odotettu, ref.weight(pekka)); feed(ref, pekka); feed(ref, pekka); feed(ref, pekka); feed(ref, pekka); assertEquals( "Feeding should increase the weight by one kilo. Check code: \n" + "ref = Reformatory(); " + "pekka = new Person(\"Pekka\", 33, 175, 78); " + "ref.feed(pekka); " + "ref.feed(pekka); " + "ref.feed(pekka); " + "ref.feed(pekka); " + "ref.feed(pekka); " + "System.out.println( pekka.getWeight() )", odotettu + 4, pekka.getWeight()); }