HardcodedStackVersionPropertiesCheck extends AbstractCheckDescriptor { public static Pattern getHardcodeSearchPattern(String hdpVersion) { return Pattern.compile("(?<!-Dhdp\\.version=)" + hdpVersion.replace(".", "\\.")); } HardcodedStackVersionPropertiesCheck(); @Override void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request); static Pattern getHardcodeSearchPattern(String hdpVersion); static boolean stringContainsVersionHardcode(String string, Pattern searchPattern);  }
@Test public void testGetHardcodeSearchPattern() throws Exception { Pattern p = HardcodedStackVersionPropertiesCheck.getHardcodeSearchPattern(currentVersion); assertEquals(p.pattern(), "(?<!-Dhdp\\.version=)2\\.3\\.4\\.0-1234"); }