Browse Source

Moved the robot object to setUp method

Radoslav Radoev 9 years ago
parent
commit
f114759f75
1 changed files with 6 additions and 1 deletions
  1. 6
    1
      exercises/robot-name/src/test/java/RobotTest.java

+ 6
- 1
exercises/robot-name/src/test/java/RobotTest.java View File

@@ -1,5 +1,6 @@
1 1
 import org.junit.Test;
2 2
 import org.junit.Ignore;
3
+import org.junit.Before;
3 4
 
4 5
 import static org.hamcrest.CoreMatchers.equalTo;
5 6
 import static org.hamcrest.core.Is.is;
@@ -9,8 +10,12 @@ import static org.junit.Assert.assertThat;
9 10
 public class RobotTest {
10 11
 
11 12
     private static final String EXPECTED_ROBOT_NAME_PATTERN = "[A-Z]{2}\\d{3}";
12
-    private final Robot robot = new Robot();
13
+    private Robot robot;
13 14
 
15
+    @Before
16
+    public void setUp() {
17
+      robot = new Robot();
18
+    }
14 19
 
15 20
     @Test
16 21
     public void hasName() {