Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/main/java/io/zipcoder/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,10 @@


public class Application {

public static void main(String[] args){
System.out.println("How many pets do you have?");

}

}
4 changes: 4 additions & 0 deletions src/main/java/io/zipcoder/pets/Cat.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package io.zipcoder.pets;

public class Cat extends Pet {
}
5 changes: 5 additions & 0 deletions src/main/java/io/zipcoder/pets/Dog.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package io.zipcoder.pets;

public class Dog extends Pet {

}
8 changes: 8 additions & 0 deletions src/main/java/io/zipcoder/pets/Pet.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package io.zipcoder.pets;

public class Pet {

// speak()
// name field w/ setters and getters

}
4 changes: 4 additions & 0 deletions src/main/java/io/zipcoder/pets/Rabbit.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package io.zipcoder.pets;

public class Rabbit extends Pet{
}
7 changes: 7 additions & 0 deletions src/test/java/io/zipcoder/ApplicationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,11 @@


public class ApplicationTest {
Application applicationTest = new Application();
}

//@Test
//public void userInput(){
// // Given

}
16 changes: 16 additions & 0 deletions src/test/java/io/zipcoder/pets/CatTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package io.zipcoder.pets;

import org.junit.Assert;
import org.junit.Test;

public class CatTest {

@Test
public void testMeow() {
Pet cat = new Cat();
String expected = "Meow";
String actual = cat.speak();

Assert.assertEquals(expected, actual);
}
}
15 changes: 15 additions & 0 deletions src/test/java/io/zipcoder/pets/DogTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package io.zipcoder.pets;

import org.junit.Assert;
import org.junit.Test;

public class DogTest {
@Test
public void testBark() {
Pet dog = new Dog();
String expected = "Woof";
String actual = dog.speak();

Assert.assertEquals(expected, actual);
}
}
72 changes: 72 additions & 0 deletions src/test/java/io/zipcoder/pets/PetTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package io.zipcoder.pets;

import org.junit.Assert;
import org.junit.Test;

/**
* filename:
* project: Interfaces
* author: https://github.com/vvmk
* date: 2/26/18
*/
public class PetTest {
@Test
public void testCompareDiffPetTypePositive() {
Pet dog = new Dog();
Pet cat = new Cat();

int expected = 1;
int actual = cat.compareTo(dog);

Assert.assertEquals(expected, actual);
}

@Test
public void testCompareDiffPetTypeNegative() {
Pet Bugs = new Rabbit();
Pet Sylvester = new Cat();

int expected = -1;
int actual = Bugs.compareTo(Sylvester);

Assert.assertEquals(expected, actual);
}

@Test
public void testCompareSamePetTypeDiffNamePositive() {
Pet first = new Dog("Abbey");
Pet second = new Dog("Ziggy");

int expected = 1;
int actual = first.compareTo(second);

Assert.assertEquals(expected, actual);
}

@Test
public void testCompareSamePetTypeDiffNameNegative() {
Pet second = new Dog("Zulu");
Pet first = new Dog("Arnold");

int expected = -1;
int actual = second.compareTo(first);

Assert.assertEquals(expected, actual);
}

@Test
public void testCompareSamePetTypeSameName() {
Pet dog1 = new Dog("Dan");
Pet dog2 = new Dog("Dan");

int expected = 0;
int actual = dog1.compareTo(dog2);

Assert.assertEquals(expected, actual);
}

@Test
public void testToString() {

}
}
16 changes: 16 additions & 0 deletions src/test/java/io/zipcoder/pets/RabbitTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package io.zipcoder.pets;

import org.junit.Assert;
import org.junit.Test;

public class RabbitTest {
@Test
public void testUhhhRabbitSoundsIDK() {
Pet rabbit = new Rabbit();
rabbit.setName("Bugs");
String expected = "What's up, Doc?";
String actual = rabbit.speak();

Assert.assertEquals(expected, actual);
}
}