Skip to content

Commit 549f81b

Browse files
committed
chore: apply review findings
1 parent c6ce9b6 commit 549f81b

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

examples/src/main/java/com/fingerprint/example/FunctionalTests.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
public class FunctionalTests {
1616
public static void main(String... args) {
1717
String FPJS_API_SECRET = System.getenv("FPJS_API_SECRET");
18-
String FPJS_VISITOR_ID = "";
19-
String FPJS_REQUEST_ID = "";
2018
String FPJS_API_REGION = System.getenv("FPJS_API_REGION");
2119
String FPJS_REQUEST_ID_TO_UPDATE = System.getenv("FPJS_REQUEST_ID_TO_UPDATE");
2220
String FPJS_VISITOR_ID_TO_DELETE = System.getenv("FPJS_VISITOR_ID_TO_DELETE");
21+
String FPJS_VISITOR_ID = "";
22+
String FPJS_REQUEST_ID = "";
2323

2424
// Create a new instance of the API client
2525
ApiClient client = Configuration.getDefaultApiClient(FPJS_API_SECRET, FPJS_API_REGION != null ? FPJS_API_REGION : "us");
@@ -34,6 +34,10 @@ public static void main(String... args) {
3434
.setStart(start)
3535
.setEnd(end)
3636
);
37+
if (events.getEvents().isEmpty()) {
38+
System.err.println("FingerprintApi.searchEvents: is empty");
39+
System.exit(1);
40+
}
3741
Identification firstEventIdentificationData = events.getEvents().get(0).getProducts().getIdentification().getData();
3842
FPJS_VISITOR_ID = firstEventIdentificationData.getVisitorId();
3943
FPJS_REQUEST_ID = firstEventIdentificationData.getRequestId();
@@ -93,9 +97,19 @@ public static void main(String... args) {
9397
.setEnd(end)
9498
.setReverse(true)
9599
);
100+
if (oldEvents.getEvents().isEmpty()) {
101+
System.err.println("FingerprintApi.searchEvents: is empty for old events");
102+
System.exit(1);
103+
}
96104
Identification oldEventIdentificationData = oldEvents.getEvents().get(0).getProducts().getIdentification().getData();
97105
String FPJS_OLD_VISITOR_ID = oldEventIdentificationData.getVisitorId();
98106
String FPJS_OLD_REQUEST_ID = oldEventIdentificationData.getRequestId();
107+
108+
if (FPJS_VISITOR_ID.equals(FPJS_OLD_VISITOR_ID) || FPJS_REQUEST_ID.equals(FPJS_OLD_REQUEST_ID)) {
109+
System.err.println("Old events are identical to new");
110+
System.exit(1);
111+
}
112+
99113
api.getEvent(FPJS_OLD_REQUEST_ID);
100114
api.getVisits(FPJS_OLD_VISITOR_ID, null, null, null, null, null);
101115
System.out.println("Old events are good");

0 commit comments

Comments
 (0)