@Test public void test_resolve() { CobolFieldTypeResolver resolver = new CobolFieldTypeResolver(); assertEquals(CobolFieldType.ALPHA_NUMERIC, resolver.resolve("X")); assertEquals(CobolFieldType.ALPHA_NUMERIC, resolver.resolve("XX")); assertEquals(CobolFieldType.ALPHA_NUMERIC, resolver.resolve("X(2)")); assertEquals(CobolFieldType.ALPHA_NUMERIC, resolver.resolve("X(22)")); assertEquals(CobolFieldType.ALPHA_NUMERIC, resolver.resolve("x")); assertEquals(CobolFieldType.ALPHA_NUMERIC, resolver.resolve("xx")); assertEquals(CobolFieldType.ALPHA_NUMERIC, resolver.resolve("x(2)")); assertEquals(CobolFieldType.ALPHA_NUMERIC, resolver.resolve("x(22)")); assertEquals(CobolFieldType.INTEGER, resolver.resolve("9")); assertEquals(CobolFieldType.INTEGER, resolver.resolve("99")); assertEquals(CobolFieldType.INTEGER, resolver.resolve("9(2)")); assertEquals(CobolFieldType.INTEGER, resolver.resolve("9(22)")); assertEquals(CobolFieldType.DECIMAL, resolver.resolve("9v9")); assertEquals(CobolFieldType.DECIMAL, resolver.resolve("9v99")); assertEquals(CobolFieldType.DECIMAL, resolver.resolve("99v9")); assertEquals(CobolFieldType.DECIMAL, resolver.resolve("9(2)v9")); assertEquals(CobolFieldType.DECIMAL, resolver.resolve("9(22)v9")); assertEquals(CobolFieldType.DECIMAL, resolver.resolve("9(2)v99")); assertEquals(CobolFieldType.DECIMAL, resolver.resolve("9(2)v9(2)")); assertEquals(CobolFieldType.DECIMAL, resolver.resolve("9(22)v9(22)")); assertEquals(CobolFieldType.DECIMAL, resolver.resolve("9(2)V9")); }
public CobolFieldType resolve(String pattern) { if (Pattern.matches(CobolFieldPatternValidator.ALPHANUMERIC_PATTERN, pattern)) { return CobolFieldType.ALPHA_NUMERIC; } else if (Pattern.matches(CobolFieldPatternValidator.INTEGER_PATTERN, pattern)) { return CobolFieldType.INTEGER; } else if (Pattern.matches(CobolFieldPatternValidator.DECIMAL_PATTERN, pattern)) { return CobolFieldType.DECIMAL; } return null; }
CobolFieldTypeResolver { public CobolFieldType resolve(String pattern) { if (Pattern.matches(CobolFieldPatternValidator.ALPHANUMERIC_PATTERN, pattern)) { return CobolFieldType.ALPHA_NUMERIC; } else if (Pattern.matches(CobolFieldPatternValidator.INTEGER_PATTERN, pattern)) { return CobolFieldType.INTEGER; } else if (Pattern.matches(CobolFieldPatternValidator.DECIMAL_PATTERN, pattern)) { return CobolFieldType.DECIMAL; } return null; } }
CobolFieldTypeResolver { public CobolFieldType resolve(String pattern) { if (Pattern.matches(CobolFieldPatternValidator.ALPHANUMERIC_PATTERN, pattern)) { return CobolFieldType.ALPHA_NUMERIC; } else if (Pattern.matches(CobolFieldPatternValidator.INTEGER_PATTERN, pattern)) { return CobolFieldType.INTEGER; } else if (Pattern.matches(CobolFieldPatternValidator.DECIMAL_PATTERN, pattern)) { return CobolFieldType.DECIMAL; } return null; }  }
CobolFieldTypeResolver { public CobolFieldType resolve(String pattern) { if (Pattern.matches(CobolFieldPatternValidator.ALPHANUMERIC_PATTERN, pattern)) { return CobolFieldType.ALPHA_NUMERIC; } else if (Pattern.matches(CobolFieldPatternValidator.INTEGER_PATTERN, pattern)) { return CobolFieldType.INTEGER; } else if (Pattern.matches(CobolFieldPatternValidator.DECIMAL_PATTERN, pattern)) { return CobolFieldType.DECIMAL; } return null; }  CobolFieldType resolve(String pattern); }
CobolFieldTypeResolver { public CobolFieldType resolve(String pattern) { if (Pattern.matches(CobolFieldPatternValidator.ALPHANUMERIC_PATTERN, pattern)) { return CobolFieldType.ALPHA_NUMERIC; } else if (Pattern.matches(CobolFieldPatternValidator.INTEGER_PATTERN, pattern)) { return CobolFieldType.INTEGER; } else if (Pattern.matches(CobolFieldPatternValidator.DECIMAL_PATTERN, pattern)) { return CobolFieldType.DECIMAL; } return null; }  CobolFieldType resolve(String pattern);  }