Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] Address verification details lost during deserialization #289

Merged
merged 2 commits into from
Nov 16, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/test/java/com/easypost/AddressTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.easypost.exception.General.EndOfPaginationError;
import com.easypost.model.Address;
import com.easypost.model.AddressCollection;
import com.easypost.model.Error;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

Expand All @@ -14,6 +15,7 @@
import java.util.Map;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
Expand Down Expand Up @@ -81,8 +83,14 @@ public void testCreateVerify() throws EasyPostException {
assertEquals("417 MONTGOMERY ST FL 5", address.getStreet1());

assertNotNull(address.getVerifications());
assertNotNull(address.getVerifications().getZip4().getErrors()); // Should have a error due to second line
assertNotNull(address.getVerifications().getDelivery().getErrors());

assertFalse(address.getVerifications().getDelivery().getErrors().isEmpty()); // should have at least one error
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: the double negative is hard to read. We should probably be asserting that it is present instead

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IDE didn't like that we weren't using this "simplified" way.

Error error = address.getVerifications().getDelivery().getErrors().get(0);
assertEquals("E.SECONDARY_INFORMATION.INVALID", error.getCode());

assertFalse(address.getVerifications().getZip4().getErrors().isEmpty()); // should have at least one error
error = address.getVerifications().getZip4().getErrors().get(0);
assertEquals("E.SECONDARY_INFORMATION.INVALID", error.getCode());
}

/**
Expand Down