HandlerFactory { public static ChainResponsibilityHandler createLatinPatternHandler() { ChainResponsibilityHandler handler = new LatinLetters(); handler.linkSuccessor(new LatinLettersSmall()).linkSuccessor(new LatinAsciiDigits()); return handler; } private  HandlerFactory(); static ChainResponsibilityHandler createEastAsiaPatternHandler(); static ChainResponsibilityHandler createLatinPatternHandler();  }
@Test public void createLatinPatternHandler() { ChainResponsibilityHandler chainResponsibilityHandler = HandlerFactory.createLatinPatternHandler(); Assert.assertEquals(chainResponsibilityHandler.handleRequest("ACD"), "AAA"); Assert.assertEquals(chainResponsibilityHandler.handleRequest("åæç"), "aaa"); Assert.assertEquals(chainResponsibilityHandler.handleRequest("úêðñ"), "aaaa"); Assert.assertEquals(chainResponsibilityHandler.handleRequest("APZ"), "AAA"); Assert.assertEquals(chainResponsibilityHandler.handleRequest("Mk0"), "Aa9"); }
@Test public void createLatinPatternHandlerWithnumber() { ChainResponsibilityHandler chainResponsibilityHandler = HandlerFactory.createLatinPatternHandler(); Assert.assertEquals(chainResponsibilityHandler.handleRequest("098"), "999"); }