PositiveBoundHiveDecimal extends BoundaryDecimal<PositiveBoundHiveDecimal.PositiveBoundHiveDecimalTag> { public List<Map<String, String>> pipelinePossibleStates(PositiveBoundHiveDecimalTag action, List<Map<String, String>> possibleStateList) { return returnStates(action, possibleStateList, setParameters(action, true)); }  Class<PositiveBoundHiveDecimalTag> getTagActionClass(); String getTagName(); String getTagNameSpace(); List<Map<String, String>> pipelinePossibleStates(PositiveBoundHiveDecimalTag action,
                                                            List<Map<String, String>> possibleStateList);  }
@Test public void minMaxTest() { Map<String, String> variableDomains = new HashMap<>(); List<Map<String, String>> listOfMaps = new LinkedList<>(); listOfMaps.add(variableDomains); PositiveBoundHiveDecimal minMaxTest = new PositiveBoundHiveDecimal(); PositiveBoundHiveDecimal.PositiveBoundHiveDecimalTag tag = new PositiveBoundHiveDecimal.PositiveBoundHiveDecimalTag(); tag.setName("Name"); tag.setMin("10"); tag.setMax("20"); Assert.assertEquals(tag.getMin(), "10"); Assert.assertEquals(tag.getMax(), "20"); tag.setMin("100"); tag.setMax("200"); Assert.assertEquals(tag.getMin(), "100"); Assert.assertEquals(tag.getMax(), "200"); List<Map<String, String>> newList = minMaxTest.pipelinePossibleStates(tag, listOfMaps); Assert.assertEquals(newList.get(0).get("Name"), "100"); Assert.assertEquals(newList.get(1).get("Name"), "200"); }
@Test public void minLenTest() { Map<String, String> variableDomains = new HashMap<>(); List<Map<String, String>> listOfMaps = new LinkedList<>(); listOfMaps.add(variableDomains); PositiveBoundHiveDecimal minLenTest = new PositiveBoundHiveDecimal(); PositiveBoundHiveDecimal.PositiveBoundHiveDecimalTag tag = new PositiveBoundHiveDecimal.PositiveBoundHiveDecimalTag(); tag.setName("name"); tag.setMinLen("10"); Assert.assertEquals(tag.getMinLen(), "10"); tag.setMinLen("100"); Assert.assertEquals(tag.getMinLen(), "100"); List<Map<String, String>> newList = minLenTest.pipelinePossibleStates(tag, listOfMaps); Assert.assertEquals(newList.get(1).get("name").length(), 11); Assert.assertEquals(newList.get(2).get("name").length(), 10); }
@Test public void maxLenTest() { Map<String, String> variableDomains = new HashMap<>(); List<Map<String, String>> listOfMaps = new LinkedList<>(); listOfMaps.add(variableDomains); PositiveBoundHiveDecimal maxLenTest = new PositiveBoundHiveDecimal(); PositiveBoundHiveDecimal.PositiveBoundHiveDecimalTag tag = new PositiveBoundHiveDecimal.PositiveBoundHiveDecimalTag(); tag.setName("name"); tag.setMinLen("100"); Assert.assertEquals(tag.getMinLen(), "100"); List<Map<String, String>> newList = maxLenTest.pipelinePossibleStates(tag, listOfMaps); Assert.assertEquals(newList.get(1).get("name").length(), 11); Assert.assertEquals(newList.get(2).get("name").length(), 10); }
@Test public void minLenAndmaxLenTest() { Map<String, String> variableDomains = new HashMap<>(); List<Map<String, String>> listOfMaps = new LinkedList<>(); listOfMaps.add(variableDomains); PositiveBoundHiveDecimal maxLenTest = new PositiveBoundHiveDecimal(); PositiveBoundHiveDecimal.PositiveBoundHiveDecimalTag tag = new PositiveBoundHiveDecimal.PositiveBoundHiveDecimalTag(); tag.setName("name"); tag.setMinLen("5"); tag.setMaxLen("9"); List<Map<String, String>> newList = maxLenTest.pipelinePossibleStates(tag, listOfMaps); Assert.assertEquals(newList.get(0).get("name").length(), 5); Assert.assertEquals(newList.get(1).get("name").length(), 9); }
@Test public void defaultBehaviorTest() { Map<String, String> variableDomains = new HashMap<>(); List<Map<String, String>> listOfMaps = new LinkedList<>(); listOfMaps.add(variableDomains); PositiveBoundHiveDecimal setTest = new PositiveBoundHiveDecimal(); PositiveBoundHiveDecimal.PositiveBoundHiveDecimalTag tag = new PositiveBoundHiveDecimal.PositiveBoundHiveDecimalTag(); tag.setName("Name"); List<Map<String, String>> newList = setTest.pipelinePossibleStates(tag, listOfMaps); Assert.assertEquals(newList.get(1).get("Name").length(), 11); Assert.assertEquals(newList.get(2).get("Name").length(), 10); }
@Test public void minLenAndMaxTest() { Map<String, String> variableDomains = new HashMap<>(); List<Map<String, String>> listOfMaps = new LinkedList<>(); listOfMaps.add(variableDomains); PositiveBoundHiveDecimal defaultBehavior = new PositiveBoundHiveDecimal(); PositiveBoundHiveDecimal.PositiveBoundHiveDecimalTag tag = new PositiveBoundHiveDecimal.PositiveBoundHiveDecimalTag(); tag.setName("name"); tag.setMinLen("10"); tag.setMax("1000"); List<Map<String, String>> newList = defaultBehavior.pipelinePossibleStates(tag, listOfMaps); Assert.assertEquals(newList.get(0).get("name"), "0"); Assert.assertEquals(newList.get(1).get("name"), "-9999999999"); Assert.assertEquals(newList.get(2).get("name"), "1000"); Assert.assertEquals(newList.get(3).get("name"), "-4999999499"); Assert.assertEquals(newList.get(4).get("name"), ""); }
@Test public void minAndMaxLenTest() { Map<String, String> variableDomains = new HashMap<>(); List<Map<String, String>> listOfMaps = new LinkedList<>(); listOfMaps.add(variableDomains); PositiveBoundHiveDecimal defaultBehavior = new PositiveBoundHiveDecimal(); PositiveBoundHiveDecimal.PositiveBoundHiveDecimalTag tag = new PositiveBoundHiveDecimal.PositiveBoundHiveDecimalTag(); tag.setName("name"); tag.setMin("10"); tag.setMaxLen("12"); List<Map<String, String>> newList = defaultBehavior.pipelinePossibleStates(tag, listOfMaps); Assert.assertEquals(newList.get(0).get("name"), "10"); Assert.assertEquals(newList.get(1).get("name").length(), 10); }