yanghua commented on a change in pull request #1302: [HUDI-595] code cleanup, refactoring code out of PR# 1159 URL: https://github.com/apache/incubator-hudi/pull/1302#discussion_r374130365
########## File path: hudi-client/src/test/java/org/apache/hudi/index/bloom/TestHoodieGlobalBloomIndex.java ########## @@ -265,21 +265,29 @@ public void testTagLocation() throws Exception { JavaRDD<HoodieRecord> taggedRecordRDD = index.tagLocation(recordRDD, jsc, table); for (HoodieRecord record : taggedRecordRDD.collect()) { - if (record.getRecordKey().equals("000")) { - assertTrue(record.getCurrentLocation().getFileId().equals(FSUtils.getFileId(filename0))); - assertEquals(((TestRawTripPayload) record.getData()).getJsonData(), rowChange1.getJsonData()); - } else if (record.getRecordKey().equals("001")) { - assertTrue(record.getCurrentLocation().getFileId().equals(FSUtils.getFileId(filename2))); - assertEquals(((TestRawTripPayload) record.getData()).getJsonData(), rowChange2.getJsonData()); - } else if (record.getRecordKey().equals("002")) { - assertTrue(!record.isCurrentLocationKnown()); - assertEquals(((TestRawTripPayload) record.getData()).getJsonData(), rowChange3.getJsonData()); - } else if (record.getRecordKey().equals("003")) { - assertTrue(record.getCurrentLocation().getFileId().equals(FSUtils.getFileId(filename3))); - assertEquals(((TestRawTripPayload) record.getData()).getJsonData(), rowChange5.getJsonData()); - } else if (record.getRecordKey().equals("004")) { - assertTrue(record.getCurrentLocation().getFileId().equals(FSUtils.getFileId(filename3))); - assertEquals(((TestRawTripPayload) record.getData()).getJsonData(), rowChange4.getJsonData()); + switch (record.getRecordKey()) { + case "000": + assertEquals(record.getCurrentLocation().getFileId(), FSUtils.getFileId(filename0)); + assertEquals(((TestRawTripPayload) record.getData()).getJsonData(), rowChange1.getJsonData()); + break; + case "001": + assertEquals(record.getCurrentLocation().getFileId(), FSUtils.getFileId(filename2)); + assertEquals(((TestRawTripPayload) record.getData()).getJsonData(), rowChange2.getJsonData()); + break; + case "002": + assertFalse(record.isCurrentLocationKnown()); + assertEquals(((TestRawTripPayload) record.getData()).getJsonData(), rowChange3.getJsonData()); + break; + case "003": + assertEquals(record.getCurrentLocation().getFileId(), FSUtils.getFileId(filename3)); + assertEquals(((TestRawTripPayload) record.getData()).getJsonData(), rowChange5.getJsonData()); + break; + case "004": + assertEquals(record.getCurrentLocation().getFileId(), FSUtils.getFileId(filename3)); + assertEquals(((TestRawTripPayload) record.getData()).getJsonData(), rowChange4.getJsonData()); + break; + default: + throw new IllegalArgumentException("Unknown Key Type :" + record.getRecordKey()); Review comment: Shall we need to add `Type` here or just "Unknown key"? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services