NumberMapping { public boolean match(Integer size, Integer decimalDigits) { if (size == null || decimalDigits == null) { return false; } return (columnSizeMin == null || size >= columnSizeMin) && (columnSizeMax == null || size < columnSizeMax) && (columnDecimalDigitsMin == null || decimalDigits >= columnDecimalDigitsMin) && (columnDecimalDigitsMax == null || decimalDigits < columnDecimalDigitsMax); }  MappedType getMappedType(); Integer getColumnSizeMin(); Integer getColumnSizeMax(); Integer getColumnDecimalDigitsMin(); Integer getColumnDecimalDigitsMax(); boolean match(Integer size, Integer decimalDigits); @Override String toString();  }
@Test public void matchOk() { NumberMapping nm = new NumberMapping(); nm.setColumnSizeMin(1); nm.setColumnSizeMax(11); nm.setColumnDecimalDigitsMin(1); nm.setColumnDecimalDigitsMax(4); Assert.assertTrue(nm.match(1, 1)); Assert.assertTrue(nm.match(10, 3)); Assert.assertFalse(nm.match(1, 4)); Assert.assertFalse(nm.match(11, 1)); Assert.assertFalse(nm.match(1, null)); Assert.assertFalse(nm.match(1, null)); Assert.assertFalse(nm.match(null, null)); }
@Test public void matchOkWhenMaxIsNull() { NumberMapping nm = new NumberMapping(); nm.setColumnSizeMin(11); nm.setColumnSizeMax(null); nm.setColumnDecimalDigitsMin(4); nm.setColumnDecimalDigitsMax(null); Assert.assertTrue(nm.match(11, 4)); Assert.assertTrue(nm.match(22, 22)); Assert.assertFalse(nm.match(10, 4)); Assert.assertFalse(nm.match(11, 3)); Assert.assertFalse(nm.match(1, null)); Assert.assertFalse(nm.match(1, null)); Assert.assertFalse(nm.match(null, null)); }