diff options
| author | mokha <mokha@cisco.com> | 2019-05-03 12:33:03 -0600 |
|---|---|---|
| committer | mokha <mokha@cisco.com> | 2019-05-03 12:33:03 -0600 |
| commit | b9e941c4dd5911e21a84a555efbc57ccb5eb9dd7 (patch) | |
| tree | 91a1e14fe1643592d4107574697cb498d02a803f | |
| parent | 14df7364f9922fde90083d6774a82461e3a4e6e4 (diff) | |
use array initializer syntax
| -rw-r--r-- | assignments/assignment1/src/test/java/ca/mokhan/assignment1/BanffMarathonRunnerTest.java | 49 |
1 files changed, 26 insertions, 23 deletions
diff --git a/assignments/assignment1/src/test/java/ca/mokhan/assignment1/BanffMarathonRunnerTest.java b/assignments/assignment1/src/test/java/ca/mokhan/assignment1/BanffMarathonRunnerTest.java index 499be9c..96700aa 100644 --- a/assignments/assignment1/src/test/java/ca/mokhan/assignment1/BanffMarathonRunnerTest.java +++ b/assignments/assignment1/src/test/java/ca/mokhan/assignment1/BanffMarathonRunnerTest.java @@ -6,31 +6,29 @@ import junit.framework.TestSuite; public class BanffMarathonRunnerTest extends TestCase { - private BanffMarathonRunner john; - private BanffMarathonRunner kate; - private BanffMarathonRunner[] runners = new BanffMarathonRunner[15]; + private BanffMarathonRunner john = new BanffMarathonRunner("John", "Lenthen", 243, 1); + private BanffMarathonRunner kate = new BanffMarathonRunner("Kate", "Hen", 265, 8); + private BanffMarathonRunner[] runners = { + new BanffMarathonRunner("Elena", "Brandon", 341, 1), + new BanffMarathonRunner("Thomas", "Molson", 273, 2), + new BanffMarathonRunner("Hamilton", "Winn", 278, 5), + new BanffMarathonRunner("Suzie", "Sarandin", 329, 7), + new BanffMarathonRunner("Philip", "Winne", 445, 9), + new BanffMarathonRunner("Alex", "Trebok", 275, 3), + new BanffMarathonRunner("Emma", "Pivoto", 275, 4), + this.john, + new BanffMarathonRunner("James", "Lean", 334, 1), + new BanffMarathonRunner("Jane", "Ostin", 412, 1), + new BanffMarathonRunner("Emily", "Car", 393, 4), + new BanffMarathonRunner("Daniel", "Hamshire", 299, 4), + new BanffMarathonRunner("Neda", "Bazdar", 343, 3), + new BanffMarathonRunner("Aaron", "Smith", 317, 6), + this.kate + }; public BanffMarathonRunnerTest(String testName) { super(testName); - this.john = new BanffMarathonRunner("John", "Lenthen", 243, 1); - - this.runners[0] = new BanffMarathonRunner("Elena", "Brandon", 341, 1); - this.runners[1] = new BanffMarathonRunner("Thomas", "Molson", 273, 2); - this.runners[2] = new BanffMarathonRunner("Hamilton", "Winn", 278, 5); - this.runners[3] = new BanffMarathonRunner("Suzie", "Sarandin", 329, 7); - this.runners[4] = new BanffMarathonRunner("Philip", "Winne", 445, 9); - this.runners[5] = new BanffMarathonRunner("Alex", "Trebok", 275, 3); - this.runners[6] = new BanffMarathonRunner("Emma", "Pivoto", 275, 4); - this.runners[7] = this.john; - this.runners[8] = new BanffMarathonRunner("James", "Lean", 334, 1); - this.runners[9] = new BanffMarathonRunner("Jane", "Ostin", 412, 1); - this.runners[10] = new BanffMarathonRunner("Emily", "Car", 393, 4); - this.runners[11] = new BanffMarathonRunner("Daniel", "Hamshire", 299, 4); - this.runners[12] = new BanffMarathonRunner("Neda", "Bazdar", 343, 3); - this.runners[13] = new BanffMarathonRunner("Aaron", "Smith", 317, 6); - this.kate = new BanffMarathonRunner("Kate", "Hen", 265, 8); - this.runners[14] = this.kate; } public static Test suite() @@ -55,8 +53,13 @@ public class BanffMarathonRunnerTest extends TestCase public void testGetAboveAverageRunners() { - String expected = "Elena 1\r\n" + "Suzie 7\r\n" + "Philip 9\r\n" + - "James 1\r\n" + "Jane 1\r\n" + "Emily 4\r\n" + "Neda 3\r\n"; + String expected = "Elena 1\r\n" + + "Suzie 7\r\n" + + "Philip 9\r\n" + + "James 1\r\n" + + "Jane 1\r\n" + + "Emily 4\r\n" + + "Neda 3\r\n"; assertEquals(expected, BanffMarathonRunner.getAboveAverageRunners(this.runners)); } } |
