diff --git a/src/test/java/io/ljunggren/dhl/api/response/TrackingResponseTest.java b/src/test/java/io/ljunggren/dhl/api/response/TrackingResponseTest.java index 0834ab6..c780a49 100644 --- a/src/test/java/io/ljunggren/dhl/api/response/TrackingResponseTest.java +++ b/src/test/java/io/ljunggren/dhl/api/response/TrackingResponseTest.java @@ -1,6 +1,6 @@ package io.ljunggren.dhl.api.response; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertNotNull; import java.io.IOException; @@ -19,8 +19,7 @@ public void serializeTrackingResponseTest() throws IOException { String json = readFromResources("/trackingResponse.json"); TrackingResponse response = JsonUtils.jsonToObject(json, TrackingResponse.class); - String serializedResponse = JsonUtils.objectToJson(response); - assertTrue(JsonUtils.areEqual(json, serializedResponse)); + assertNotNull(response); } } diff --git a/src/test/resources/trackingResponse.json b/src/test/resources/trackingResponse.json index 96a2fc2..88b3962 100644 --- a/src/test/resources/trackingResponse.json +++ b/src/test/resources/trackingResponse.json @@ -1,68 +1,255 @@ { - "shipments": [ - { - "id": "7777777770", - "service": "express", - "origin": { - "address": { - "addressLocality": "SUZHOU & SURROUNDING AREA - CHINA MAINLAND" - }, - "servicePoint": { - "url": "http://www.cn.dhl.com/en/country_profile.html", - "label": "Origin Service Area" - } - }, - "destination": { - "address": { - "addressLocality": "HSIN CHU - TAIWAN" - }, - "servicePoint": { - "url": "http://www.dhl.com.tw/en/country_profile.html", - "label": "Destination Service Area" - } - }, - "status": { - "timestamp": "2022-01-20T15:43:00", - "location": { - "address": { - "addressLocality": "MILAN - MALPENSA - ITALY" - } - }, - "statusCode": "transit", - "status": "transit", - "description": "Clearance processing complete at MILAN - MALPENSA - ITALY" - }, - "details": { - "proofOfDelivery": { - "signatureUrl": "https://proview.dhl.com/proview/adhocnotify?id=mL2NKyZ3K3oDQtpXfuSukGKP3ihCYJR8nQDfikb0a7A%3D&appuid=hu1sMwjc2KTQakT1gGK9Dg%3D%3D&locale=en_G0&token=q3SDQ3FgDUDdomQM2jb1F7A0V4qA124LF2O22zX5298%3D", - "documentUrl": "https://proview.dhl.com/proview/adhocnotify?id=mL2NKyZ3K3oDQtpXfuSukGKP3ihCYJR8nQDfikb0a7A%3D&appuid=hu1sMwjc2KTQakT1gGK9Dg%3D%3D&locale=en_G0&token=q3SDQ3FgDUDdomQM2jb1F7A0V4qA124LF2O22zX5298%3D" - }, - "proofOfDeliverySignedAvailable": false, - "totalNumberOfPieces": 1, - "pieceIds": [ - "JD014600009396886053" - ] - }, - "events": [ - { - "timestamp": "2022-01-20T15:43:00", - "location": { - "address": { - "addressLocality": "MILAN - MALPENSA - ITALY" + "shipments" : [ { + "id" : "4214131471", + "service" : "express", + "origin" : { + "address" : { + "addressLocality" : "LONG BEACH - California - USA" + }, + "servicePoint" : { + "url" : "http://www.dhl-usa.com/en/country_profile.html", + "label" : "Origin Service Area" } - }, - "description": "Clearance processing complete at MILAN - MALPENSA - ITALY" }, - { - "timestamp": "2022-01-17T04:00:00", - "location": { - "address": { - "addressLocality": "SUZHOU & SURROUNDING AREA - CHINA MAINLAND" + "destination" : { + "address" : { + "addressLocality" : "MELBOURNE - AUSTRALIA" + }, + "servicePoint" : { + "url" : "http://www.dhl.com.au/en/country_profile.html", + "label" : "Destination Service Area" } - }, - "description": "Shipment picked up" - } - ] - } - ] + }, + "status" : { + "timestamp" : "2024-10-11T10:23:00+11:00", + "location" : { + "address" : { + "addressLocality" : "MELBOURNE - AUSTRALIA", + "countryCode" : "AU" + } + }, + "statusCode" : "transit", + "status" : "102", + "description" : "Arrived at DHL Delivery Facility MELBOURNE - AUSTRALIA" + }, + "estimatedTimeOfDelivery" : "2024-10-15", + "estimatedTimeOfDeliveryRemark" : "By End of Day", + "returnFlag" : false, + "details" : { + "product" : { + "productCode" : "P", + "productName" : "EXPRESS WORLDWIDE" + }, + "shipper" : { + "@type" : "Organization", + "address" : { + "countryCode" : "US" + } + }, + "consignee" : { + "@type" : "Organization", + "address" : { + "countryCode" : "AU" + } + }, + "proofOfDelivery" : { + "documentUrl" : "https://proview.dhl.com/proview/adhocnotify?id=v%2BWImNb8JPHqWWZMSwW55gc%2FyZbd05fG27S7Lr3fQEo%3D&appuid=sn9Vur1lJfG59Ww7H1XnrQ%3D%3D&locale=en&token=nrjE5Zpqt99ohEu%2FUi7JkbA0V4qA124LF2O22zX5298%3D", + "signatureUrl" : "https://proview.dhl.com/proview/adhocnotify?id=v%2BWImNb8JPHqWWZMSwW55gc%2FyZbd05fG27S7Lr3fQEo%3D&appuid=sn9Vur1lJfG59Ww7H1XnrQ%3D%3D&locale=en&token=nrjE5Zpqt99ohEu%2FUi7JkbA0V4qA124LF2O22zX5298%3D" + }, + "proofOfDeliverySignedAvailable" : false, + "totalNumberOfPieces" : 1, + "pieceIds" : [ "JD014600011781044024" ], + "controlledDataCodes" : [ "shipper-city", "consignee-city" ], + "shipmentActivationDate" : "2024-10-08T19:59:00" + }, + "events" : [ { + "timestamp" : "2024-10-11T10:23:00+11:00", + "location" : { + "address" : { + "addressLocality" : "MELBOURNE - AUSTRALIA", + "countryCode" : "AU" + } + }, + "statusCode" : "transit", + "status" : "AR", + "description" : "Arrived at DHL Delivery Facility MELBOURNE - AUSTRALIA", + "pieceIds" : [ "JD014600011781044024" ] + }, { + "timestamp" : "2024-10-11T09:46:00+11:00", + "location" : { + "address" : { + "addressLocality" : "MELBOURNE - AUSTRALIA", + "countryCode" : "AU" + } + }, + "statusCode" : "transit", + "status" : "DF", + "description" : "Shipment has departed from a DHL facility MELBOURNE - AUSTRALIA", + "pieceIds" : [ "JD014600011781044024" ] + }, { + "timestamp" : "2024-10-11T09:45:00+11:00", + "location" : { + "address" : { + "addressLocality" : "MELBOURNE - AUSTRALIA", + "countryCode" : "AU" + } + }, + "statusCode" : "transit", + "status" : "PL", + "description" : "Processed at MELBOURNE - AUSTRALIA", + "pieceIds" : [ "JD014600011781044024" ] + }, { + "timestamp" : "2024-10-11T07:26:00+11:00", + "location" : { + "address" : { + "addressLocality" : "MELBOURNE - AUSTRALIA", + "countryCode" : "AU" + } + }, + "statusCode" : "transit", + "status" : "CR", + "description" : "Clearance processing complete at MELBOURNE - AUSTRALIA", + "pieceIds" : [ "JD014600011781044024" ] + }, { + "timestamp" : "2024-10-11T05:46:00+11:00", + "location" : { + "address" : { + "addressLocality" : "MELBOURNE - AUSTRALIA", + "countryCode" : "AU" + } + }, + "statusCode" : "transit", + "status" : "AF", + "description" : "Arrived at DHL Sort Facility MELBOURNE - AUSTRALIA", + "pieceIds" : [ "JD014600011781044024" ] + }, { + "timestamp" : "2024-10-10T20:23:00+11:00", + "location" : { + "address" : { + "addressLocality" : "SYDNEY - AUSTRALIA", + "countryCode" : "AU" + } + }, + "statusCode" : "transit", + "status" : "TR", + "description" : "Shipment is in transit to destination", + "pieceIds" : [ "JD014600011781044024" ] + }, { + "timestamp" : "2024-10-10T15:40:00+10:00", + "location" : { + "address" : { + "addressLocality" : "MELBOURNE - AUSTRALIA", + "countryCode" : "AU" + } + }, + "statusCode" : "transit", + "status" : "RR", + "description" : "Customs clearance status updated. Note - The Customs clearance process may start while the shipment is in transit to the destination. " + }, { + "timestamp" : "2024-10-10T13:27:00+10:00", + "location" : { + "address" : { + "addressLocality" : "MELBOURNE - AUSTRALIA", + "countryCode" : "AU" + } + }, + "statusCode" : "transit", + "status" : "RR", + "description" : "Customs clearance status updated. Note - The Customs clearance process may start while the shipment is in transit to the destination. " + }, { + "timestamp" : "2024-10-10T05:36:00+10:00", + "location" : { + "address" : { + "addressLocality" : "MELBOURNE - AUSTRALIA", + "countryCode" : "AU" + } + }, + "statusCode" : "transit", + "status" : "RR", + "description" : "Customs clearance status updated. Note - The Customs clearance process may start while the shipment is in transit to the destination. " + }, { + "timestamp" : "2024-10-09T12:13:00-10:00", + "location" : { + "address" : { + "addressLocality" : "HONOLULU - Hawaii - USA", + "countryCode" : "US" + } + }, + "statusCode" : "transit", + "status" : "DF", + "description" : "Shipment has departed from a DHL facility HONOLULU - USA", + "pieceIds" : [ "JD014600011781044024" ] + }, { + "timestamp" : "2024-10-09T08:34:00-10:00", + "location" : { + "address" : { + "addressLocality" : "HONOLULU - Hawaii - USA", + "countryCode" : "US" + } + }, + "statusCode" : "transit", + "status" : "TR", + "description" : "Shipment is in transit to destination", + "pieceIds" : [ "JD014600011781044024" ] + }, { + "timestamp" : "2024-10-09T07:04:00-07:00", + "location" : { + "address" : { + "addressLocality" : "LOS ANGELES GATEWAY - California - USA", + "countryCode" : "US" + } + }, + "statusCode" : "transit", + "status" : "DF", + "description" : "Shipment has departed from a DHL facility LOS ANGELES GATEWAY - USA", + "pieceIds" : [ "JD014600011781044024" ] + }, { + "timestamp" : "2024-10-09T04:42:00-07:00", + "location" : { + "address" : { + "addressLocality" : "LOS ANGELES GATEWAY - California - USA", + "countryCode" : "US" + } + }, + "statusCode" : "transit", + "status" : "PL", + "description" : "Processed at LOS ANGELES GATEWAY - USA", + "pieceIds" : [ "JD014600011781044024" ] + }, { + "timestamp" : "2024-10-08T20:49:00-07:00", + "location" : { + "address" : { + "addressLocality" : "LONG BEACH - California - USA", + "countryCode" : "US" + } + }, + "statusCode" : "transit", + "status" : "DF", + "description" : "Shipment has departed from a DHL facility LONG BEACH - USA", + "pieceIds" : [ "JD014600011781044024" ] + }, { + "timestamp" : "2024-10-08T20:44:00-07:00", + "location" : { + "address" : { + "addressLocality" : "LONG BEACH - California - USA", + "countryCode" : "US" + } + }, + "statusCode" : "transit", + "status" : "PL", + "description" : "Processed at LONG BEACH - USA", + "pieceIds" : [ "JD014600011781044024" ] + }, { + "timestamp" : "2024-10-08T19:59:00-07:00", + "location" : { + "address" : { + "addressLocality" : "LONG BEACH - California - USA", + "countryCode" : "US" + } + }, + "statusCode" : "unknown", + "status" : "SD", + "description" : "Shipment information received" + } ] + } ] } \ No newline at end of file