40 lines
1.2 KiB
Java
40 lines
1.2 KiB
Java
package com.magnifyb.comparingcmsapi;
|
|
|
|
import org.testng.annotations.Test;
|
|
|
|
import com.fasterxml.jackson.databind.JsonNode;
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
|
import io.restassured.RestAssured;
|
|
import io.restassured.response.Response;
|
|
|
|
public class GetModules {
|
|
|
|
@Test
|
|
public void modules() {
|
|
String testApiUrl = "https://magnifytest.machint.com/module_master";
|
|
String devApiUrl = "https://magnifyservice.machint.com/module_master";
|
|
|
|
Response devResponse = RestAssured.get(devApiUrl);
|
|
Response testResponse = RestAssured.get(testApiUrl);
|
|
|
|
ObjectMapper objectMapper = new ObjectMapper();
|
|
try {
|
|
JsonNode devJson = objectMapper.readTree(devResponse.getBody().asString());
|
|
JsonNode testJson = objectMapper.readTree(testResponse.getBody().asString());
|
|
|
|
if (devJson.equals(testJson)) {
|
|
System.out.println("The responses are the same.");
|
|
} else {
|
|
System.out.println("The responses are different.");
|
|
// Add logic to print or handle the differences as needed
|
|
// For example, you can print the differing parts
|
|
System.out.println("Dev Response: " + devJson);
|
|
System.out.println("Test Response: " + testJson);
|
|
}
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
}
|