I am trying to compare the rest API response of two environments. I am using rest assured to get the response back. The problem I am facing is that I get a hashmap back which has a couple of hashmaps.
I have tried flattening the map into one map but keep on missing a hierarchy when the response differs slightly
here is a sample of the rest response
{
programmes:[
{
episodenumber:21,
seasonnumber:5,
seasontitle:"program Season 5",
seasonuuid:"7aabb30e-39a1-48bb-8dca-38f732c9c982",
seriestitle:"programm",
seriesuuid:"f95caa09-8cd7-4e23-a88a-444f7932714d",
sy:"blah blah blah. (S5, ep 21)",
t:"blah blah Fathers",
trailer:false,
type:"programme",
uuid:"69b91264-37c9-4b2f-a515-b45805a58867",
uuidtype:"programme",
waystowatch:{
svod:[
{
ad:false,
added:1495800164,
at:"DD",
availendtime:1497729599,
broadcasttime:1495137600,
cgid:10053,
cgname:"blah",
channelname:"blah1 HD",
d:2880,
downloadlink:"oig://FFC27E94",
hardofhearing:false,
is3d:false,
providerid:"ab_st_hd",
providername:"blah HD",
s:true,
sid:4061,
size:2352611,
sy:"blah blah. (S5, ep 21)",
videotype:"HD"
}
}
] ps:255,
tc:3
}
I am using the guava diff lib and for that, i need a simple map. I know this might not be the best of doing this comparison but this is for a short duration and this is what I can come up with. My question is how do I either flatten this response to make one map which i can pass to
MapDifference<String, ?> diff = Maps.difference(test, test2);
or is there a better way to compare two responses in rest assured. I have to get both the response at runtime.