Skip to content

Commit

Permalink
fix: fixed tests for safelist getters
Browse files Browse the repository at this point in the history
  • Loading branch information
tiwarishubham635 committed Nov 22, 2023
1 parent 69a7a6a commit a37d7d1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions examples/java/unit-test/rest/TwilioRestTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1274,15 +1274,15 @@ public void testSafelistCrud() {

@Test
public void testSafelistObjectCreation() {
String json = "{\"testInteger\": 123}";
String json = "{\"phoneNumber\": 123}";
Safelist safelistString = Safelist.fromJson(json, objectMapper);

String initialString = "{\"testInteger\": 123}";
String initialString = "{\"phoneNumber\": 123}";
InputStream targetStream = new ByteArrayInputStream(initialString.getBytes());
Safelist safelistInputStream = Safelist.fromJson(targetStream, objectMapper);

assertEquals((Integer)123, safelistString.getTestInteger());
assertEquals((Integer)123, safelistInputStream.getTestInteger());
assertEquals((Integer)123, safelistString.getPhoneNumber());
assertEquals((Integer)123, safelistInputStream.getPhoneNumber());
}

@Test(expected = ApiException.class)
Expand All @@ -1304,8 +1304,8 @@ public void testShouldAddSafelistSidIfNotPresent() {
"/v1/SafeList/Numbers.json"
);
when(twilioRestClient.request(mockRequest)).thenReturn(new Response("{\"sid\":\"SID\", \"phoneNumber\":\"123\"}", 200));
Safelist safelist = new SafelistFetcher("123").fetch(twilioRestClient);
assertNotNull(call);
Safelist safelist = new SafelistFetcher().setPhoneNumber("123").fetch(twilioRestClient);
assertNotNull(safelist);
assertEquals("123", safelist.getPhoneNumber());
assertEquals("SID", safelist.getSid());
}
Expand Down

0 comments on commit a37d7d1

Please sign in to comment.