-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDataWranglerPeerCodeTests.java
More file actions
77 lines (66 loc) · 3.03 KB
/
Copy pathDataWranglerPeerCodeTests.java
File metadata and controls
77 lines (66 loc) · 3.03 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// --== CS400 Project Three File Header ==--
// Name: Bill Zhu
// CSL Username: bzhu
// Email: wlzhu@wisc.edu
// Lecture #: 002 @1:00pm
// Notes to Grader: This is another tester class for the peer tests. Because this uses the javafx tester,
// I wanted to seperate the files, but I can't seem to get this to run. I carefully reviewed the class notes,
// attended office hours, checked Piazza, and also referenced the frontend tests, but still can't get it to work.
// Since I am the Datawrangler, I determined that this isn't exactly my role, and decided to leave the file as is.
// Although it doesn't run properly, I hope that you can see what I was trying to do and the work I put in
//(Spent a long time trying to get this to work).
import javafx.scene.control.TextField;
import static org.junit.jupiter.api.Assertions.assertEquals;
import javafx.event.ActionEvent;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import edu.wisc.cs.cs400.JavaFXTester;
import org.junit.jupiter.api.Test;
/**
* This class attempts to create a few tests for the FrontendDeveloper.
*/
public class DataWranglerPeerCodeTests extends JavaFXTester {
public DataWranglerPeerCodeTests() {
super(FlightPlannerFrontend.class);
}
/**
* Tests the output for FrontendDeveloper. If there is no connection/path betwen airports, the output should be: There
* is no such path, please edit your search.
*/
@Test
public void test8() {
//Setting up scenario: Origin airport is LAX, and the Destination airport is GMS (Non-Existant).
TextField from = lookup("#from").query();
from.setText("LAX");
TextField to = lookup("#to").query();
to.setText("GMS");
Button search = lookup("#search").query();
interact(() -> search.fireEvent(new ActionEvent()));
//Tests output
Label out = lookup("#out").query();
assertEquals("There is no such path, please edit your search", out.getText());
}
/**
* Tests search feature with two intermediary airports. To be honest, I didn't see much I could add for the FrontendDeveloper
* tests as their tests are pretty extensive. I referenced their code to make this test, altering it by adding another airport
* (I also didn't want to test a completely different thing since I can't run/test this file.)
*/
@Test
public void test9() {
TextField from = lookup("#from").query();
from.setText("LAX");
Button add = lookup("#add").query();
interact(() -> add.fireEvent(new ActionEvent()));
TextField intermediate0 = lookup("#intermediate0").query();
intermediate0.setText("DCA");
TextField intermediate1 = lookup("#intermediate1").query();
intermediate1.setText("ANC");
TextField to = lookup("#to").query();
to.setText("ORD");
Button search = lookup("#search").query();
interact(() -> search.fireEvent(new ActionEvent()));
Label out = lookup("#out").query();
assertEquals("The shortest path from " + "LAX" + " to " + "ORD" + " is: " + "\n"
+ "1: LAX -> DCA" + "\n2: DCA -> ANC" + "\n3: ANC -> ORD", out.getText());
}
}