Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 6 additions & 2 deletions src/test/java/com/facebook/ads/ServerSideTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


public class ServerSideTest {
Expand Down Expand Up @@ -85,10 +86,13 @@ public void CustomDataParametersTest() {
String serializedPayload = eventRequest.getSerializedPayload();

// ASSERT
String cpString = (new Gson()).toJson(customProperties);
String serializedContents = (new Gson()).toJson(contents);
String serializedContentIds = (new Gson()).toJson(contentIds);
Assert.assertTrue(serializedPayload.contains(cpString.substring(1, cpString.length() - 1)));

Map<String, String> mp = customProperties;
mp.forEach((key, value) -> Assert.assertTrue(serializedPayload.contains(
"\"" + key + "\":" + "\"" + value + "\""
)));
Assert.assertTrue(serializedPayload.contains(serializedContents));
Assert.assertTrue(serializedPayload.contains(serializedContentIds));
Assert.assertTrue(serializedPayload.contains(currency.toLowerCase()));
Expand Down
8 changes: 5 additions & 3 deletions src/test/java/com/facebook/ads/SignalTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class SignalTest {
@Test
Expand Down Expand Up @@ -100,8 +101,9 @@ public void EventRequestTest() {
Assert.assertTrue(bdapiDataJSON.contains("\"event_name\":\"Purchase\""));

String capiDataJSON = (new Gson()).toJson(capiEventRequest.getData());
String customPropertiesJSON = (new Gson()).toJson(customProperties);
Assert.assertTrue(capiDataJSON
.contains(customPropertiesJSON.substring(1, customPropertiesJSON.length() - 1)));
Map<String, String> mp = customProperties;
mp.forEach((key, value) -> Assert.assertTrue(capiDataJSON.contains(
"\"" + key + "\":" + "\"" + value + "\""
)));
}
}