(Map<String, Object> expectedMap, Map<String, Object> convertedMap)
| 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) { |
no test coverage detected