Skip to content

Commit eba07bf

Browse files
committed
fixed customTurtle bug
1 parent 2fe489b commit eba07bf

1 file changed

Lines changed: 29 additions & 30 deletions

File tree

_sources/Unit2-Using-Objects/topic-2-2-constructors.rst

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -465,49 +465,22 @@ You will use the constructor(s) to create the CustomTurtles below. You can speci
465465
{
466466
World world = new World(400,400);
467467

468-
// Create a large 150x200 CustomTurtle with a green body (Color.green)
468+
// 1. Create a large 150x200 CustomTurtle with a green body (Color.green)
469469
// and a blue shell (Color.blue) at position (150,300).
470470
// Move it forward to see it.
471471

472472

473473

474-
// Create a small 25x50 CustomTurtle with a red body
474+
// 2. Create a small 25x50 CustomTurtle with a red body
475475
// and a yellow shell at position (350,200)
476476
// Move it forward to see it.
477477

478478

479-
// Create a CustomTurtle of your own design
479+
// 3. Create a CustomTurtle of your own design
480480

481481
world.show(true);
482482
}
483483
}
484-
====
485-
import static org.junit.Assert.*;
486-
import org.junit.*;;
487-
import java.io.*;
488-
489-
public class RunestoneTests extends CodeTestHelper
490-
{
491-
public RunestoneTests() {
492-
super("CustomTurtleRunner");
493-
}
494-
495-
@Test
496-
public void test1()
497-
{
498-
String target = "new CustomTurtle(150,300,world, Color.green, Color.blue, 180, 200)";
499-
boolean passed = checkCodeContains("constructor for a large 150x200 CustomTurtle with a green body and a blue shell at position (150,300)",target);
500-
assertTrue(passed);
501-
}
502-
@Test
503-
public void test2()
504-
{
505-
String target = "new CustomTurtle(350,200,world, Color.red, Color.yellow, 25, 50)";
506-
boolean passed = checkCodeContains("constructor for a small 25x50 CustomTurtle with a red body and a yellow shell at position (350,200)",target);
507-
assertTrue(passed);
508-
}
509-
}
510-
511484

512485
class CustomTurtle extends Turtle
513486
{
@@ -574,6 +547,32 @@ You will use the constructor(s) to create the CustomTurtles below. You can speci
574547
setWidth(w);
575548
}
576549
}
550+
====
551+
import static org.junit.Assert.*;
552+
import org.junit.*;;
553+
import java.io.*;
554+
555+
public class RunestoneTests extends CodeTestHelper
556+
{
557+
public RunestoneTests() {
558+
super("CustomTurtleRunner");
559+
}
560+
561+
@Test
562+
public void test1()
563+
{
564+
String target = "new CustomTurtle(150,300,world, Color.green, Color.blue, 180, 200)";
565+
boolean passed = checkCodeContains("constructor for a large 150x200 CustomTurtle with a green body and a blue shell at position (150,300)",target);
566+
assertTrue(passed);
567+
}
568+
@Test
569+
public void test2()
570+
{
571+
String target = "new CustomTurtle(350,200,world, Color.red, Color.yellow, 25, 50)";
572+
boolean passed = checkCodeContains("constructor for a small 25x50 CustomTurtle with a red body and a yellow shell at position (350,200)",target);
573+
assertTrue(passed);
574+
}
575+
}
577576

578577
Summary
579578
-------------------

0 commit comments

Comments
 (0)