forked from goshippo/shippo-java-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTrackTest.java
More file actions
49 lines (38 loc) · 1.7 KB
/
TrackTest.java
File metadata and controls
49 lines (38 loc) · 1.7 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
package com.shippo.model;
import static org.junit.Assert.*;
import org.junit.Test;
import com.shippo.exception.APIConnectionException;
import com.shippo.exception.APIException;
import com.shippo.exception.AuthenticationException;
import com.shippo.exception.InvalidRequestException;
public class TrackTest extends ShippoTest {
final static String carrier = "usps";
final static String number = "9200190195851637950376";
private void checkTrack(Track track) {
assertEquals(track.getCarrier(), carrier);
assertEquals(track.getTrackingNumber(), number);
assertEquals(track.getTrackingStatus().getStatus(), Track.TrackingStatus.DELIVERED);
}
@Test
public void testGet() throws AuthenticationException, InvalidRequestException,
APIConnectionException, APIException {
Track track = Track.getTrackingInfo(carrier, number, null);
checkTrack(track);
}
@Test(expected = InvalidRequestException.class)
public void testGetInvalidCarrier() throws AuthenticationException, InvalidRequestException,
APIConnectionException, APIException {
Track.getTrackingInfo("bad", number, null);
}
@Test(expected = InvalidRequestException.class)
public void testGetInvalidCarrierNumber() throws AuthenticationException, InvalidRequestException,
APIConnectionException, APIException {
Track.getTrackingInfo(carrier, "invalid", null);
}
@Test
public void testRegisterWebhook() throws AuthenticationException, InvalidRequestException,
APIConnectionException, APIException {
Track track = Track.registerTrackingWebhook(carrier, number, "meta", null);
checkTrack(track);
}
}