MCPcopy Create free account
hub / github.com/apache/pig / mapEquals

Method mapEquals

test/org/apache/pig/test/utils/TestHelper.java:278–301  ·  view source on GitHub ↗
(Map<String, Object> expectedMap, Map<String, Object> convertedMap)

Source from the content-addressed store, hash-verified

276
277 //a quick way to check for map equality as the map value returned by PigStorage has byte array
278 public static boolean mapEquals(Map<String, Object> expectedMap, Map<String, Object> convertedMap) {
279 if(expectedMap == null) {
280 if(convertedMap != null) {
281 return false;
282 }
283 } else {
284 if (convertedMap == null) {
285 return false;
286 }
287 }
288
289 if(expectedMap.size() != convertedMap.size()) {
290 return false;
291 }
292
293 for(String key: expectedMap.keySet()) {
294 Object v = convertedMap.get(key);
295 String convertedValue = new String(((DataByteArray)v).get());
296 if(!expectedMap.get(key).toString().equals(convertedValue)) {
297 return false;
298 }
299 }
300 return true;
301 }
302
303 @SuppressWarnings("unchecked")
304 public static boolean tupleEquals(Tuple expectedTuple, Tuple convertedTuple) {

Callers 2

testBytesToMapMethod · 0.95
tupleEqualsMethod · 0.95

Calls 5

sizeMethod · 0.65
getMethod · 0.65
keySetMethod · 0.45
equalsMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected