EquivalenceClassTransformer implements DataTransformer { private void zip(StringBuilder b) { generateFromRegex(b, "^((\\d{5})([- ]\\d{4})?)$"); } EquivalenceClassTransformer(); @Override void transform(DataPipe cr); static final String[] CURRENCY_CODES; static final String[] STATE_LONG; static final String[] STATES_SHORT; static final Holiday[] HOLIDAYS; static final String[] COUNTRIES; static final int COUNT_NASDAQ_SECURITIES; static final String[] SYMBOLS_NASDAQ; static final String[] SECURITY_NAMES_NASDAQ; static final int COUNT_NOT_NASDAQ_SECURITIES; static final String[] SYMBOLS_NOT_NASDAQ; static final String[] SECURITY_NAMES_NOT_NASDAQ; }
@Test public void zipTest() { DataPipe pipeToTransform = new DataPipe(); EquivalenceClassTransformer eqTransformer = new EquivalenceClassTransformer(); for (int i = 0; i < 500; i++) { pipeToTransform.getDataMap().put("TEST_zip", "%zip"); eqTransformer.transform(pipeToTransform); Pattern alphaWithSpacesPattern = Pattern.compile("^((\\d{5})([- ]\\d{4})?)$"); Matcher didItMatch = alphaWithSpacesPattern.matcher(pipeToTransform.getDataMap().get("TEST_zip")); Assert.assertTrue(didItMatch.matches()); } }