public static void main(String[] args) {
PairTest test = new PairTest();
test.testLatLongPair();
test.testNameAgePair();
test.testComplexCase();
test.printSummary();
}
private void testLatLongPair() { header("Starting -- testLatLongPair"); //Declare Pair<Double, Double> pair; double latitude = 45.094167, longitude = -93.356111; //Construct pair = new Pair<>(latitude, longitude); //Test assertEquals(latitude, pair.getFirst()); assertEquals(longitude, pair.getSecond()); }
private void testNameAgePair() { header("Starting -- testNameAgePair"); //Declare Pair<String, Integer> pair; String nm = "Chin"; int age = 25; //Construct pair = new Pair<>(nm, age); //Test assertEquals(nm, pair.getFirst()); assertEquals(age, pair.getSecond()); }
private void testComplexCase() { header("Starting -- testComplexCase"); //Declare Pair<List<String>, List<String>> teamPair; List<String> team1 = Arrays.asList("Riya", "Asha"), team2 = Arrays.asList("Chin", "Bruce"); //Construct teamPair = new Pair<>(team1, team2); //Test assertEquals(team1, teamPair.getFirst()); assertEquals(team2, teamPair.getSecond()); }
package pair.test; import java.util.Arrays; import java.util.List; import pair.model.Pair; import testutil.AbstractTest; import testutil.Employee; public class PairTest extends AbstractTest { //-------------------------- //Main (Entry Point) public static void main(String[] args) { PairTest test = new PairTest(); test.testLatLongPair(); test.testNameAgePair(); test.testComplexCase(); test.printSummary(); } //-------------------------- //Tests private void testLatLongPair() { header("Starting -- testLatLongPair"); //Declare Pair<Double, Double> pair; double latitude = 45.094167, longitude = -93.356111; //Construct pair = new Pair<>(latitude, longitude); //Test assertEquals(latitude, pair.getFirst()); assertEquals(longitude, pair.getSecond()); } private void testNameAgePair() { header("Starting -- testNameAgePair"); //Declare Pair<String, Integer> pair; String nm = "Chin"; int age = 25; //Construct pair = new Pair<>(nm, age); //Test assertEquals(nm, pair.getFirst()); assertEquals(age, pair.getSecond()); } private void testComplexCase() { header("Starting -- testComplexCase"); //Declare Pair<List<String>, List<String>> teamPair; List<String> team1 = Arrays.asList("Riya", "Asha"), team2 = Arrays.asList("Chin", "Bruce"); //Construct teamPair = new Pair<>(team1, team2); //Test assertEquals(team1, teamPair.getFirst()); assertEquals(team2, teamPair.getSecond()); } }