-
Notifications
You must be signed in to change notification settings - Fork 64
Expand file tree
/
Copy pathPetTest.java
More file actions
30 lines (27 loc) · 854 Bytes
/
PetTest.java
File metadata and controls
30 lines (27 loc) · 854 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package io.zipcoder.pets;
import org.junit.Assert;
import org.junit.Test;
import java.util.ArrayList;
import java.util.Collections;
public class PetTest {
@Test
public void sortPetTest(){
Application test = new Application();
ArrayList<Pet> petTest = new ArrayList<Pet>();
Cat cat1 = new Cat("Apple");
Dog dog2 = new Dog("Apple");
Dog dog1 = new Dog("Bob");
Fish fish1 = new Fish("Cathy");
petTest.add(cat1);
petTest.add(dog2);
petTest.add(dog1);
petTest.add(fish1);
Collections.sort(petTest);
String expected = "Apple : Meow!\n" +
"Apple : Woof!\n" +
"Bob : Woof!\n" +
"Cathy : Blub blub\n";
String actual = test.showPetList(petTest);
Assert.assertEquals(expected, actual);
}
}