Skip to content

Commit

Permalink
Fixed Flaky Test: CustomDataParametersTest
Browse files Browse the repository at this point in the history
  • Loading branch information
Deeksha Cheruku committed Oct 14, 2023
1 parent 8e9d475 commit ac33855
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/test/java/com/facebook/ads/ServerSideTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,13 @@ public void CustomDataParametersTest() {
String serializedPayload = eventRequest.getSerializedPayload();

// ASSERT
String cpString = (new Gson()).toJson(customProperties);
String serializedContents = (new Gson()).toJson(contents);
String cpStringPattern1 = "\"Key2\":\"Value2\",\"Key1\":\"Value1\"";
String cpStringPattern2 = "\"Key1\":\"Value1\",\"Key2\":\"Value2\"";
String serializedContentsPattern1 = "{\"brand\":\"brandA\",\"id\":\"1\"},{\"brand\":\"brandB\",\"id\":\"2\"}";
String serializedContentsPattern2 = "{\"id\":\"1\",\"brand\":\"brandA\"},{\"id\":\"2\",\"brand\":\"brandB\"}";
String serializedContentIds = (new Gson()).toJson(contentIds);
Assert.assertTrue(serializedPayload.contains(cpString.substring(1, cpString.length() - 1)));
Assert.assertTrue(serializedPayload.contains(serializedContents));
Assert.assertTrue(serializedPayload.contains(cpStringPattern1) || serializedPayload.contains(cpStringPattern2));
Assert.assertTrue(serializedPayload.contains(serializedContentsPattern1) || serializedPayload.contains(serializedContentsPattern2));
Assert.assertTrue(serializedPayload.contains(serializedContentIds));
Assert.assertTrue(serializedPayload.contains(currency.toLowerCase()));
Assert.assertTrue(serializedPayload.contains(contentCategory));
Expand Down

0 comments on commit ac33855

Please sign in to comment.