AlgorithmSwitch { public static String getPostAlgoResult(String algoName, String algoPara, String colValue) { BlockingKeyPostAlgorithmEnum typeBySavedValue = BlockingKeyPostAlgorithmEnum.getTypeBySavedValue(algoName); if (typeBySavedValue == null) { return StringUtils.EMPTY; } switch (typeBySavedValue) { case LEFT_CHAR: return AlgoBox.add_Left_Char(colValue, algoPara); case RIGHT_CHAR: return AlgoBox.add_Right_Char(colValue, algoPara); case NON_ALGO: break; case USE_DEFAULT: return AlgoBox.useDefault(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 testGetPostAlgoResult() { assertEquals(TEST_STR, AlgorithmSwitch.getPostAlgoResult( BlockingKeyPostAlgorithmEnum.USE_DEFAULT.getComponentValueName(), TEST_STR, BLANK_STR)); assertEquals(SPACE_STR, AlgorithmSwitch.getPostAlgoResult( BlockingKeyPostAlgorithmEnum.USE_DEFAULT.getComponentValueName(), BLANK_STR, SPACE_STR)); assertEquals(TEST_STR, AlgorithmSwitch .getPostAlgoResult(BlockingKeyPostAlgorithmEnum.USE_DEFAULT.getComponentValueName(), TEST_STR, null)); assertEquals(TEST_STR, AlgorithmSwitch.getPostAlgoResult( BlockingKeyPostAlgorithmEnum.USE_DEFAULT.getComponentValueName(), SPACE_STR, TEST_STR)); assertEquals("Test test12", AlgorithmSwitch.getPostAlgoResult(BlockingKeyPostAlgorithmEnum.USE_DEFAULT.getComponentValueName(), NULL_STR, "Test test12")); }