PositiveBoundHiveVarchar extends BoundaryVarchar<PositiveBoundHiveVarchar.PositiveBoundHiveVarcharTag> { public List<Map<String, String>> pipelinePossibleStates(PositiveBoundHiveVarcharTag action, List<Map<String, String>> possibleStateList) { return returnStates(action, possibleStateList, buildVarcharData(action, true)); }  Class<PositiveBoundHiveVarcharTag> getTagActionClass(); String getTagName(); String getTagNameSpace(); List<Map<String, String>> pipelinePossibleStates(PositiveBoundHiveVarcharTag action,
                                            List<Map<String, String>> possibleStateList);  }
@Test public void lengthTest2() { Map<String, String> variableDomains = new HashMap<>(); List<Map<String, String>> listOfMaps = new LinkedList<>(); listOfMaps.add(variableDomains); PositiveBoundHiveVarchar maxLenTest = new PositiveBoundHiveVarchar(); PositiveBoundHiveVarchar.PositiveBoundHiveVarcharTag pos = new PositiveBoundHiveVarchar.PositiveBoundHiveVarcharTag(); pos.setName("name"); pos.setMaxLen("10"); Assert.assertEquals(pos.getMaxLen(), "10"); pos.setMaxLen("12"); Assert.assertEquals(pos.getMaxLen(), "12"); List<Map<String, String>> newList = maxLenTest.pipelinePossibleStates(pos, listOfMaps); Assert.assertEquals(newList.get(0).get("name").length(), 1); Assert.assertEquals(newList.get(1).get("name").length(), 10); }
@Test public void minLenTest() { Map<String, String> variableDomains = new HashMap<>(); List<Map<String, String>> listOfMaps = new LinkedList<>(); listOfMaps.add(variableDomains); PositiveBoundHiveVarchar maxLenTest = new PositiveBoundHiveVarchar(); PositiveBoundHiveVarchar.PositiveBoundHiveVarcharTag neg = new PositiveBoundHiveVarchar.PositiveBoundHiveVarcharTag(); neg.setName("name"); neg.setMinLen("10"); Assert.assertEquals(neg.getMinLen(), "10"); List<Map<String, String>> newList = maxLenTest.pipelinePossibleStates(neg, listOfMaps); Assert.assertEquals(newList.get(0).get("name").length(), 10); }
@Test public void allCapsTest() { Map<String, String> variableDomains = new HashMap<>(); List<Map<String, String>> listOfMaps = new LinkedList<>(); listOfMaps.add(variableDomains); PositiveBoundHiveVarchar maxLenTest = new PositiveBoundHiveVarchar(); PositiveBoundHiveVarchar.PositiveBoundHiveVarcharTag pos = new PositiveBoundHiveVarchar.PositiveBoundHiveVarcharTag(); pos.setName("name"); pos.setAllCaps("true"); List<Map<String, String>> newList = maxLenTest.pipelinePossibleStates(pos, listOfMaps); Assert.assertEquals(newList.get(0).get("name"), newList.get(0).get("name").toUpperCase()); Assert.assertEquals(newList.get(1).get("name"), newList.get(1).get("name").toUpperCase()); Assert.assertEquals(newList.get(3).get("name"), newList.get(3).get("name").toUpperCase()); }
@Test public void maxLenTest() { Map<String, String> variableDomains = new HashMap<>(); List<Map<String, String>> listOfMaps = new LinkedList<>(); listOfMaps.add(variableDomains); PositiveBoundHiveVarchar maxLenTest = new PositiveBoundHiveVarchar(); PositiveBoundHiveVarchar.PositiveBoundHiveVarcharTag pos = new PositiveBoundHiveVarchar.PositiveBoundHiveVarcharTag(); pos.setLength("18"); pos.setName("name"); pos.setMaxLen("10"); Assert.assertEquals(pos.getMaxLen(), "10"); pos.setMaxLen("12"); Assert.assertEquals(pos.getMaxLen(), "12"); List<Map<String, String>> newList = maxLenTest.pipelinePossibleStates(pos, listOfMaps); Assert.assertEquals(newList.get(0).get("name").length(), 1); Assert.assertEquals(newList.get(1).get("name").length(), 12); }