AlgorithmSwitch { public static String getPreAlgoResult(String algoName, String algoPara, String colValue) { BlockingKeyPreAlgorithmEnum typeBySavedValue = BlockingKeyPreAlgorithmEnum.getTypeBySavedValue(algoName); switch (typeBySavedValue) { case NON_ALGO: break; case REMOVE_MARKS: return AlgoBox.removeDiacriticalMarks(colValue); case REMOVE_MARKS_THEN_LOWER_CASE: return AlgoBox.removeDMAndLowerCase(colValue); case REMOVE_MARKS_THEN_UPPER_CASE: return AlgoBox.removeDMAndUpperCase(colValue); case LOWER_CASE: return AlgoBox.lowerCase(colValue); case UPPER_CASE: return AlgoBox.upperCase(colValue); case LEFT_CHAR: return AlgoBox.add_Left_Char(colValue, algoPara); case RIGHT_CHAR: return AlgoBox.add_Right_Char(colValue, algoPara); default: return StringUtils.EMPTY; } return StringUtils.EMPTY; } private  AlgorithmSwitch(); static String getPreAlgoResult(String algoName, String algoPara, String colValue); static String getAlgoResult(String algoName, String algoPara, String colValue); static String getPostAlgoResult(String algoName, String algoPara, String colValue);  }
@Test public void testGetPreAlgoResult() { assertEquals("<test", AlgorithmSwitch.getPreAlgoResult(BlockingKeyPreAlgorithmEnum.LEFT_CHAR.getComponentValueName(), "<", TEST_STR)); assertEquals(TEST_STR, AlgorithmSwitch .getPreAlgoResult(BlockingKeyPreAlgorithmEnum.LEFT_CHAR.getComponentValueName(), null, TEST_STR)); assertEquals(NULL_STR, AlgorithmSwitch .getPreAlgoResult(BlockingKeyPreAlgorithmEnum.LEFT_CHAR.getComponentValueName(), NULL_STR, BLANK_STR)); assertEquals("\\test", AlgorithmSwitch.getPreAlgoResult(BlockingKeyPreAlgorithmEnum.LEFT_CHAR.getComponentValueName(), "\\", TEST_STR)); assertEquals(QUO_STR, AlgorithmSwitch .getPreAlgoResult(BlockingKeyPreAlgorithmEnum.LEFT_CHAR.getComponentValueName(), QUO_STR, null)); assertEquals("test<", AlgorithmSwitch.getPreAlgoResult(BlockingKeyPreAlgorithmEnum.RIGHT_CHAR.getComponentValueName(), "<", TEST_STR)); assertEquals(TEST_STR, AlgorithmSwitch .getPreAlgoResult(BlockingKeyPreAlgorithmEnum.RIGHT_CHAR.getComponentValueName(), null, TEST_STR)); assertEquals(NULL_STR, AlgorithmSwitch .getPreAlgoResult(BlockingKeyPreAlgorithmEnum.RIGHT_CHAR.getComponentValueName(), NULL_STR, BLANK_STR)); assertEquals("test\\", AlgorithmSwitch.getPreAlgoResult(BlockingKeyPreAlgorithmEnum.RIGHT_CHAR.getComponentValueName(), "\\", TEST_STR)); assertEquals(QUO_STR, AlgorithmSwitch .getPreAlgoResult(BlockingKeyPreAlgorithmEnum.RIGHT_CHAR.getComponentValueName(), QUO_STR, null)); assertEquals(null, AlgorithmSwitch .getPreAlgoResult(BlockingKeyPreAlgorithmEnum.LOWER_CASE.getComponentValueName(), null, null)); assertEquals("test", AlgorithmSwitch.getPreAlgoResult(BlockingKeyPreAlgorithmEnum.LOWER_CASE.getComponentValueName(), null, TEST_STR)); assertEquals("test\ntest", AlgorithmSwitch .getPreAlgoResult(BlockingKeyPreAlgorithmEnum.LOWER_CASE.getComponentValueName(), null, "Test\ntest")); assertEquals("test\ttest", AlgorithmSwitch .getPreAlgoResult(BlockingKeyPreAlgorithmEnum.LOWER_CASE.getComponentValueName(), null, "Test\ttest")); assertEquals("test test123", AlgorithmSwitch.getPreAlgoResult(BlockingKeyPreAlgorithmEnum.LOWER_CASE.getComponentValueName(), null, "Test test123")); assertEquals(BLANK_STR, AlgorithmSwitch .getPreAlgoResult(BlockingKeyPreAlgorithmEnum.LOWER_CASE.getComponentValueName(), null, BLANK_STR)); assertEquals(SPACE_STR, AlgorithmSwitch .getPreAlgoResult(BlockingKeyPreAlgorithmEnum.LOWER_CASE.getComponentValueName(), null, SPACE_STR)); assertEquals(NULL_STR, AlgorithmSwitch .getPreAlgoResult(BlockingKeyPreAlgorithmEnum.LOWER_CASE.getComponentValueName(), null, "Null")); assertEquals(QUO_STR, AlgorithmSwitch .getPreAlgoResult(BlockingKeyPreAlgorithmEnum.LOWER_CASE.getComponentValueName(), null, QUO_STR)); assertEquals(null, AlgorithmSwitch .getPreAlgoResult(BlockingKeyPreAlgorithmEnum.REMOVE_MARKS.getComponentValueName(), null, null)); assertEquals(TEST_STR, AlgorithmSwitch .getPreAlgoResult(BlockingKeyPreAlgorithmEnum.REMOVE_MARKS.getComponentValueName(), null, TEST_STR)); assertEquals(BLANK_STR, AlgorithmSwitch .getPreAlgoResult(BlockingKeyPreAlgorithmEnum.REMOVE_MARKS.getComponentValueName(), null, BLANK_STR)); assertEquals("1-2;40;0-5", AlgorithmSwitch.getPreAlgoResult(BlockingKeyPreAlgorithmEnum.REMOVE_MARKS.getComponentValueName(), null, "1-2;40;0-5")); assertEquals("Test test", AlgorithmSwitch .getPreAlgoResult(BlockingKeyPreAlgorithmEnum.REMOVE_MARKS.getComponentValueName(), null, "Test test")); assertEquals(SPACE_STR, AlgorithmSwitch .getPreAlgoResult(BlockingKeyPreAlgorithmEnum.REMOVE_MARKS.getComponentValueName(), null, SPACE_STR)); assertEquals(QUO_STR, AlgorithmSwitch .getPreAlgoResult(BlockingKeyPreAlgorithmEnum.REMOVE_MARKS.getComponentValueName(), null, QUO_STR)); assertEquals(null, AlgorithmSwitch.getPreAlgoResult( BlockingKeyPreAlgorithmEnum.REMOVE_MARKS_THEN_LOWER_CASE.getComponentValueName(), null, null)); assertEquals(TEST_STR, AlgorithmSwitch.getPreAlgoResult( BlockingKeyPreAlgorithmEnum.REMOVE_MARKS_THEN_LOWER_CASE.getComponentValueName(), null, TEST_STR)); assertEquals(BLANK_STR, AlgorithmSwitch.getPreAlgoResult( BlockingKeyPreAlgorithmEnum.REMOVE_MARKS_THEN_LOWER_CASE.getComponentValueName(), null, BLANK_STR)); assertEquals("testdtestm", AlgorithmSwitch.getPreAlgoResult( BlockingKeyPreAlgorithmEnum.REMOVE_MARKS_THEN_LOWER_CASE.getComponentValueName(), null, "TestDtestM")); assertEquals("test test12", AlgorithmSwitch.getPreAlgoResult( BlockingKeyPreAlgorithmEnum.REMOVE_MARKS_THEN_LOWER_CASE.getComponentValueName(), null, "Test test12")); assertEquals(SPACE_STR, AlgorithmSwitch.getPreAlgoResult( BlockingKeyPreAlgorithmEnum.REMOVE_MARKS_THEN_LOWER_CASE.getComponentValueName(), null, SPACE_STR)); assertEquals(QUO_STR, AlgorithmSwitch.getPreAlgoResult( BlockingKeyPreAlgorithmEnum.REMOVE_MARKS_THEN_LOWER_CASE.getComponentValueName(), null, QUO_STR)); assertEquals(null, AlgorithmSwitch.getPreAlgoResult( BlockingKeyPreAlgorithmEnum.REMOVE_MARKS_THEN_UPPER_CASE.getComponentValueName(), null, null)); assertEquals("TEST", AlgorithmSwitch.getPreAlgoResult( BlockingKeyPreAlgorithmEnum.REMOVE_MARKS_THEN_UPPER_CASE.getComponentValueName(), null, TEST_STR)); assertEquals(BLANK_STR, AlgorithmSwitch.getPreAlgoResult( BlockingKeyPreAlgorithmEnum.REMOVE_MARKS_THEN_UPPER_CASE.getComponentValueName(), null, BLANK_STR)); assertEquals("TESTDTESTM1-2;40;0-5", AlgorithmSwitch.getPreAlgoResult( BlockingKeyPreAlgorithmEnum.REMOVE_MARKS_THEN_UPPER_CASE.getComponentValueName(), null, "TestDtestM1-2;40;0-5")); assertEquals("TESTDTESTMTEST TEST", AlgorithmSwitch.getPreAlgoResult( BlockingKeyPreAlgorithmEnum.REMOVE_MARKS_THEN_UPPER_CASE.getComponentValueName(), null, "TestDtestMTest test")); assertEquals(SPACE_STR, AlgorithmSwitch.getPreAlgoResult( BlockingKeyPreAlgorithmEnum.REMOVE_MARKS_THEN_UPPER_CASE.getComponentValueName(), null, SPACE_STR)); assertEquals(QUO_STR, AlgorithmSwitch.getPreAlgoResult( BlockingKeyPreAlgorithmEnum.REMOVE_MARKS_THEN_UPPER_CASE.getComponentValueName(), null, QUO_STR)); assertEquals(null, AlgorithmSwitch .getPreAlgoResult(BlockingKeyPreAlgorithmEnum.UPPER_CASE.getComponentValueName(), null, null)); assertEquals("TEST", AlgorithmSwitch .getPreAlgoResult(BlockingKeyPreAlgorithmEnum.UPPER_CASE.getComponentValueName(), null, TEST_STR)); assertEquals("TEST\nTEST", AlgorithmSwitch .getPreAlgoResult(BlockingKeyPreAlgorithmEnum.UPPER_CASE.getComponentValueName(), null, "Test\ntest")); assertEquals("TEST\tTEST", AlgorithmSwitch .getPreAlgoResult(BlockingKeyPreAlgorithmEnum.UPPER_CASE.getComponentValueName(), null, "Test\ttest")); assertEquals("TEST TEST12", AlgorithmSwitch .getPreAlgoResult(BlockingKeyPreAlgorithmEnum.UPPER_CASE.getComponentValueName(), null, "Test test12")); assertEquals(BLANK_STR, AlgorithmSwitch .getPreAlgoResult(BlockingKeyPreAlgorithmEnum.UPPER_CASE.getComponentValueName(), null, BLANK_STR)); assertEquals(SPACE_STR, AlgorithmSwitch .getPreAlgoResult(BlockingKeyPreAlgorithmEnum.UPPER_CASE.getComponentValueName(), null, SPACE_STR)); assertEquals("NULL ", AlgorithmSwitch .getPreAlgoResult(BlockingKeyPreAlgorithmEnum.UPPER_CASE.getComponentValueName(), null, "Null ")); assertEquals(QUO_STR, AlgorithmSwitch .getPreAlgoResult(BlockingKeyPreAlgorithmEnum.UPPER_CASE.getComponentValueName(), null, QUO_STR)); AlgorithmSwitch.getPreAlgoResult(BlockingKeyPreAlgorithmEnum.UPPER_CASE.getComponentValueName(), null, QUO_STR); }