| @@ -118,7 +118,7 @@ public final class LineContains | |||
| boolean matches = true; | |||
| for (int i = 0; matches && i < containsSize; i++) { | |||
| String containsStr = (String) contains.elementAt(i); | |||
| matches = line.indexOf(containsStr) >= 0; | |||
| matches = line.contains(containsStr); | |||
| } | |||
| if (matches ^ isNegated()) { | |||
| break; | |||
| @@ -428,7 +428,7 @@ public class TokenFilter extends BaseFilterReader | |||
| if (contains == null) { | |||
| throw new BuildException("Missing contains in containsstring"); | |||
| } | |||
| if (string.indexOf(contains) > -1) { | |||
| if (string.contains(contains)) { | |||
| return string; | |||
| } | |||
| return null; | |||
| @@ -1088,7 +1088,7 @@ public class Copy extends Task { | |||
| } | |||
| message.append(ex.getMessage()); | |||
| } | |||
| if (ex.getClass().getName().indexOf("MalformedInput") != -1) { | |||
| if (ex.getClass().getName().contains("MalformedInput")) { | |||
| message.append(LINE_SEPARATOR); | |||
| message.append( | |||
| "This is normally due to the input file containing invalid"); | |||
| @@ -89,7 +89,7 @@ public class Exec extends Task { | |||
| // test if os match | |||
| String myos = System.getProperty("os.name"); | |||
| log("Myos = " + myos, Project.MSG_VERBOSE); | |||
| if ((os != null) && (os.indexOf(myos) < 0)) { | |||
| if (os != null && !os.contains(myos)) { | |||
| // this command will be executed only on the specified OS | |||
| log("Not found in " + os, Project.MSG_VERBOSE); | |||
| return 0; | |||
| @@ -100,9 +100,9 @@ public class Exec extends Task { | |||
| dir = getProject().getBaseDir(); | |||
| } | |||
| if (myos.toLowerCase(Locale.ENGLISH).indexOf("windows") >= 0) { | |||
| if (myos.toLowerCase(Locale.ENGLISH).contains("windows")) { | |||
| if (!dir.equals(getProject().resolveFile("."))) { | |||
| if (myos.toLowerCase(Locale.ENGLISH).indexOf("nt") >= 0) { | |||
| if (myos.toLowerCase(Locale.ENGLISH).contains("nt")) { | |||
| command = "cmd /c cd " + dir + " && " + command; | |||
| } else { | |||
| String ant = getProject().getProperty(MagicNames.ANT_HOME); | |||
| @@ -563,7 +563,7 @@ public class ExecTask extends Task { | |||
| //for the current os.name | |||
| String myos = System.getProperty("os.name"); | |||
| log("Current OS is " + myos, Project.MSG_VERBOSE); | |||
| if ((os != null) && (os.indexOf(myos) < 0)) { | |||
| if (os != null && !os.contains(myos)) { | |||
| // this command will be executed only on the specified OS | |||
| log("This OS, " + myos | |||
| + " was not found in the specified list of valid OSes: " + os, | |||
| @@ -269,7 +269,7 @@ public abstract class JDBCTask extends Task { | |||
| String theVendor = dmd.getDatabaseProductName().toLowerCase(); | |||
| log("RDBMS = " + theVendor, Project.MSG_VERBOSE); | |||
| if (theVendor == null || theVendor.indexOf(rdbms) < 0) { | |||
| if (theVendor == null || !theVendor.contains(rdbms)) { | |||
| log("Not the required RDBMS: " + rdbms, Project.MSG_VERBOSE); | |||
| return false; | |||
| } | |||
| @@ -281,7 +281,7 @@ public abstract class JDBCTask extends Task { | |||
| log("Version = " + theVersion, Project.MSG_VERBOSE); | |||
| if (theVersion == null | |||
| || !(theVersion.startsWith(version) | |||
| || theVersion.indexOf(" " + version) >= 0)) { | |||
| || theVersion.contains(" " + version))) { | |||
| log("Not the required version: \"" + version + "\"", Project.MSG_VERBOSE); | |||
| return false; | |||
| } | |||
| @@ -2459,7 +2459,7 @@ public class Javadoc extends Task { | |||
| // check if file may be vulnerable because it was not | |||
| // patched with "validURL(url)": | |||
| if (fileContents.indexOf("function validURL(url) {") < 0) { | |||
| if (!fileContents.contains("function validURL(url) {")) { | |||
| // we need to patch the file! | |||
| final String patchedFileContents = patchContent(fileContents, fixData); | |||
| if (!patchedFileContents.equals(fileContents)) { | |||
| @@ -83,7 +83,7 @@ public class Jikes { | |||
| // Windows has a 32k limit on total arg size, so | |||
| // create a temporary file to store all the arguments | |||
| if (myos.toLowerCase(Locale.ENGLISH).indexOf("windows") >= 0 | |||
| if (myos.toLowerCase(Locale.ENGLISH).contains("windows") | |||
| && args.length > MAX_FILES_ON_COMMAND_LINE) { | |||
| BufferedWriter out = null; | |||
| try { | |||
| @@ -136,9 +136,9 @@ public class JikesOutputParser implements ExecuteStreamHandler { | |||
| if (line.trim().equals("")) { | |||
| continue; | |||
| } | |||
| if (lower.indexOf("error") != -1) { | |||
| if (lower.contains("error")) { | |||
| setError(true); | |||
| } else if (lower.indexOf("warning") != -1) { | |||
| } else if (lower.contains("warning")) { | |||
| setError(false); | |||
| } else { | |||
| // If we don't know the type of the line | |||
| @@ -754,7 +754,7 @@ public class Rmic extends MatchingTask { | |||
| if (idl) { | |||
| log("will leave uptodate test to rmic implementation in idl mode.", | |||
| Project.MSG_VERBOSE); | |||
| } else if (iiop && iiopOpts != null && iiopOpts.indexOf("-always") > -1) { | |||
| } else if (iiop && iiopOpts != null && iiopOpts.contains("-always")) { | |||
| log("no uptodate test as -always option has been specified", | |||
| Project.MSG_VERBOSE); | |||
| } else { | |||
| @@ -761,7 +761,7 @@ public class SQLExec extends JDBCTask { | |||
| // SQL defines "--" as a comment to EOL | |||
| // and in Oracle it may contain a hint | |||
| // so we cannot just remove it, instead we must end it | |||
| if (!keepformat && line.indexOf("--") >= 0) { | |||
| if (!keepformat && line.contains("--")) { | |||
| sql.append("\n"); | |||
| } | |||
| int lastDelimPos = lastDelimiterPosition(sql, line); | |||
| @@ -906,7 +906,7 @@ public class SQLExec extends JDBCTask { | |||
| } | |||
| private String maybeQuote(String s) { | |||
| if (csvQuoteChar == null || s == null || (!forceCsvQuoteChar && s.indexOf(csvColumnSep) == -1 && s.indexOf(csvQuoteChar) == -1)) { | |||
| if (csvQuoteChar == null || s == null || (!forceCsvQuoteChar && !s.contains(csvColumnSep) && !s.contains(csvQuoteChar))) { | |||
| return s; | |||
| } | |||
| StringBuilder sb = new StringBuilder(csvQuoteChar); | |||
| @@ -180,7 +180,7 @@ public class VerifyJar extends AbstractJarSignerTask { | |||
| String results = outputCache.toString(); | |||
| //deal with jdk1.4.2 bug: | |||
| if (ex != null) { | |||
| if (results.indexOf("zip file closed") >= 0) { | |||
| if (results.contains("zip file closed")) { | |||
| log("You are running " + JARSIGNER_COMMAND | |||
| + " against a JVM with a known bug that manifests as an IllegalStateException.", | |||
| Project.MSG_WARN); | |||
| @@ -188,7 +188,7 @@ public class VerifyJar extends AbstractJarSignerTask { | |||
| throw ex; | |||
| } | |||
| } | |||
| if (results.indexOf(VERIFIED_TEXT) < 0) { | |||
| if (!results.contains(VERIFIED_TEXT)) { | |||
| throw new BuildException(ERROR_NO_VERIFY + jar); | |||
| } | |||
| } | |||
| @@ -71,7 +71,7 @@ public class Contains implements Condition { | |||
| } | |||
| return caseSensitive | |||
| ? string.indexOf(subString) > -1 | |||
| : string.toLowerCase().indexOf(subString.toLowerCase()) > -1; | |||
| ? string.contains(subString) | |||
| : string.toLowerCase().contains(subString.toLowerCase()); | |||
| } | |||
| } | |||
| @@ -259,17 +259,17 @@ public class Os implements Condition { | |||
| //windows probing logic relies on the word 'windows' in | |||
| //the OS | |||
| boolean isWindows = OS_NAME.indexOf(FAMILY_WINDOWS) > -1; | |||
| boolean isWindows = OS_NAME.contains(FAMILY_WINDOWS); | |||
| boolean is9x = false; | |||
| boolean isNT = false; | |||
| if (isWindows) { | |||
| //there are only four 9x platforms that we look for | |||
| is9x = (OS_NAME.indexOf("95") >= 0 | |||
| || OS_NAME.indexOf("98") >= 0 | |||
| || OS_NAME.indexOf("me") >= 0 | |||
| is9x = (OS_NAME.contains("95") | |||
| || OS_NAME.contains("98") | |||
| || OS_NAME.contains("me") | |||
| //wince isn't really 9x, but crippled enough to | |||
| //be a muchness. Ant doesn't run on CE, anyway. | |||
| || OS_NAME.indexOf("ce") >= 0); | |||
| || OS_NAME.contains("ce")); | |||
| isNT = !is9x; | |||
| } | |||
| if (family.equals(FAMILY_WINDOWS)) { | |||
| @@ -279,28 +279,28 @@ public class Os implements Condition { | |||
| } else if (family.equals(FAMILY_NT)) { | |||
| isFamily = isWindows && isNT; | |||
| } else if (family.equals(FAMILY_OS2)) { | |||
| isFamily = OS_NAME.indexOf(FAMILY_OS2) > -1; | |||
| isFamily = OS_NAME.contains(FAMILY_OS2); | |||
| } else if (family.equals(FAMILY_NETWARE)) { | |||
| isFamily = OS_NAME.indexOf(FAMILY_NETWARE) > -1; | |||
| isFamily = OS_NAME.contains(FAMILY_NETWARE); | |||
| } else if (family.equals(FAMILY_DOS)) { | |||
| isFamily = PATH_SEP.equals(";") && !isFamily(FAMILY_NETWARE); | |||
| } else if (family.equals(FAMILY_MAC)) { | |||
| isFamily = OS_NAME.indexOf(FAMILY_MAC) > -1 | |||
| || OS_NAME.indexOf(DARWIN) > -1; | |||
| isFamily = OS_NAME.contains(FAMILY_MAC) | |||
| || OS_NAME.contains(DARWIN); | |||
| } else if (family.equals(FAMILY_TANDEM)) { | |||
| isFamily = OS_NAME.indexOf("nonstop_kernel") > -1; | |||
| isFamily = OS_NAME.contains("nonstop_kernel"); | |||
| } else if (family.equals(FAMILY_UNIX)) { | |||
| isFamily = PATH_SEP.equals(":") | |||
| && !isFamily(FAMILY_VMS) | |||
| && (!isFamily(FAMILY_MAC) || OS_NAME.endsWith("x") | |||
| || OS_NAME.indexOf(DARWIN) > -1); | |||
| || OS_NAME.contains(DARWIN)); | |||
| } else if (family.equals(FAMILY_ZOS)) { | |||
| isFamily = OS_NAME.indexOf(FAMILY_ZOS) > -1 | |||
| || OS_NAME.indexOf("os/390") > -1; | |||
| isFamily = OS_NAME.contains(FAMILY_ZOS) | |||
| || OS_NAME.contains("os/390"); | |||
| } else if (family.equals(FAMILY_OS400)) { | |||
| isFamily = OS_NAME.indexOf(FAMILY_OS400) > -1; | |||
| isFamily = OS_NAME.contains(FAMILY_OS400); | |||
| } else if (family.equals(FAMILY_VMS)) { | |||
| isFamily = OS_NAME.indexOf(FAMILY_VMS) > -1; | |||
| isFamily = OS_NAME.contains(FAMILY_VMS); | |||
| } else { | |||
| throw new BuildException( | |||
| "Don\'t know how to detect os family \"" | |||
| @@ -155,7 +155,7 @@ public class ResourceContains implements Condition { | |||
| contents = contents.toLowerCase(); | |||
| sub = sub.toLowerCase(); | |||
| } | |||
| return contents.indexOf(sub) >= 0; | |||
| return contents.contains(sub); | |||
| } catch (IOException e) { | |||
| throw new BuildException("There was a problem accessing resource : " + resource); | |||
| } | |||
| @@ -308,7 +308,7 @@ public class ANTLR extends Task { | |||
| throw new BuildException("ANTLR returned: " + err, getLocation()); | |||
| } | |||
| String output = bos.toString(); | |||
| if (output.indexOf("error:") > -1) { | |||
| if (output.contains("error:")) { | |||
| throw new BuildException("ANTLR signaled an error: " | |||
| + output, getLocation()); | |||
| } | |||
| @@ -819,24 +819,24 @@ public class NetRexxC extends MatchingTask { | |||
| } | |||
| // verbose level logging for suppressed messages | |||
| if (suppressMethodArgumentNotUsed | |||
| && l.indexOf(MSG_METHOD_ARGUMENT_NOT_USED) != -1) { | |||
| && l.contains(MSG_METHOD_ARGUMENT_NOT_USED)) { | |||
| log(l, Project.MSG_VERBOSE); | |||
| } else if (suppressPrivatePropertyNotUsed | |||
| && l.indexOf(MSG_PRIVATE_PROPERTY_NOT_USED) != -1) { | |||
| && l.contains(MSG_PRIVATE_PROPERTY_NOT_USED)) { | |||
| log(l, Project.MSG_VERBOSE); | |||
| } else if (suppressVariableNotUsed | |||
| && l.indexOf(MSG_VARIABLE_NOT_USED) != -1) { | |||
| && l.contains(MSG_VARIABLE_NOT_USED)) { | |||
| log(l, Project.MSG_VERBOSE); | |||
| } else if (suppressExceptionNotSignalled | |||
| && l.indexOf(MSG_EXCEPTION_NOT_SIGNALLED) != -1) { | |||
| && l.contains(MSG_EXCEPTION_NOT_SIGNALLED)) { | |||
| log(l, Project.MSG_VERBOSE); | |||
| } else if (suppressDeprecation | |||
| && l.indexOf(MSG_DEPRECATION) != -1) { | |||
| && l.contains(MSG_DEPRECATION)) { | |||
| log(l, Project.MSG_VERBOSE); | |||
| } else if (l.indexOf("Error:") != -1) { | |||
| } else if (l.contains("Error:")) { | |||
| // error level logging for compiler errors | |||
| log(l, Project.MSG_ERR); | |||
| } else if (l.indexOf("Warning:") != -1) { | |||
| } else if (l.contains("Warning:")) { | |||
| // warning for all warning messages | |||
| log(l, Project.MSG_WARN); | |||
| } else { | |||
| @@ -471,7 +471,7 @@ public class JonasDeploymentTool extends GenericDeploymentTool { | |||
| if (getConfig().namingScheme.getValue().equals(EjbJar.NamingScheme.DESCRIPTOR)) { | |||
| // try to find JOnAS specific convention name | |||
| if (descriptorFileName.indexOf(getConfig().baseNameTerminator) == -1) { | |||
| if (!descriptorFileName.contains(getConfig().baseNameTerminator)) { | |||
| // baseNameTerminator not found: the descriptor use the | |||
| // JOnAS naming convention, ie [Foo.xml,jonas-Foo.xml] and | |||
| @@ -42,7 +42,7 @@ public class Gcjh implements JavahAdapter { | |||
| Execute.runCommand(javah, cmd.getCommandline()); | |||
| return true; | |||
| } catch (BuildException e) { | |||
| if (e.getMessage().indexOf("failed with return code") == -1) { | |||
| if (!e.getMessage().contains("failed with return code")) { | |||
| throw e; | |||
| } | |||
| } | |||
| @@ -47,7 +47,7 @@ public class Kaffeh implements JavahAdapter { | |||
| Execute.runCommand(javah, cmd.getCommandline()); | |||
| return true; | |||
| } catch (BuildException e) { | |||
| if (e.getMessage().indexOf("failed with return code") == -1) { | |||
| if (!e.getMessage().contains("failed with return code")) { | |||
| throw e; | |||
| } | |||
| } | |||
| @@ -228,7 +228,7 @@ public class jlink { | |||
| //entry from another mergefile was called "com". | |||
| //In that case, just ignore the error and go on to the | |||
| //next entry. | |||
| if (ex.getMessage().indexOf("duplicate") >= 0) { | |||
| if (ex.getMessage().contains("duplicate")) { | |||
| //It was the duplicate entry. | |||
| continue; | |||
| } | |||
| @@ -1171,7 +1171,7 @@ public class JUnitTestRunner implements TestListener, JUnitTaskMirror.JUnitTestR | |||
| private static boolean filterLine(final String line) { | |||
| for (String filter : DEFAULT_TRACE_FILTERS) { | |||
| if (line.indexOf(filter) != -1) { | |||
| if (line.contains(filter)) { | |||
| return true; | |||
| } | |||
| } | |||
| @@ -2124,7 +2124,7 @@ public class FTP extends Task implements FTPTaskConfig { | |||
| log("Failed to issue Site Command: " + theCMD, Project.MSG_WARN); | |||
| } else { | |||
| for (String reply : ftp.getReplyStrings()) { | |||
| if (reply != null && reply.indexOf("200") == -1) { | |||
| if (reply != null && !reply.contains("200")) { | |||
| log(reply, Project.MSG_WARN); | |||
| } | |||
| } | |||
| @@ -1505,7 +1505,7 @@ public class FTPTaskMirrorImpl implements FTPTaskMirror { | |||
| Project.MSG_WARN); | |||
| } else { | |||
| for (String reply : ftp.getReplyStrings()) { | |||
| if (reply.indexOf("200") == -1) { | |||
| if (!reply.contains("200")) { | |||
| task.log(reply, Project.MSG_WARN); | |||
| } | |||
| } | |||
| @@ -452,7 +452,7 @@ public class SSHExec extends SSHBase { | |||
| } catch (final BuildException e) { | |||
| throw e; | |||
| } catch (final JSchException e) { | |||
| if (e.getMessage().indexOf("session is down") >= 0) { | |||
| if (e.getMessage().contains("session is down")) { | |||
| if (getFailonerror()) { | |||
| throw new BuildException(TIMEOUT_MESSAGE, e); | |||
| } | |||
| @@ -165,7 +165,7 @@ public class SSHSession extends SSHBase { | |||
| // completed successfully | |||
| } catch (final JSchException e) { | |||
| if (e.getMessage().indexOf("session is down") >= 0) { | |||
| if (e.getMessage().contains("session is down")) { | |||
| if (getFailonerror()) { | |||
| throw new BuildException(TIMEOUT_MESSAGE, e); | |||
| } | |||
| @@ -428,15 +428,14 @@ public class Commandline implements Cloneable { | |||
| * and double quotes. | |||
| */ | |||
| public static String quoteArgument(String argument) { | |||
| if (argument.indexOf("\"") > -1) { | |||
| if (argument.indexOf("\'") > -1) { | |||
| if (argument.contains("\"")) { | |||
| if (argument.contains("\'")) { | |||
| throw new BuildException("Can\'t handle single and double" | |||
| + " quotes in same argument"); | |||
| } | |||
| return '\'' + argument + '\''; | |||
| } | |||
| if (argument.indexOf("\'") > -1 | |||
| || argument.indexOf(" ") > -1 | |||
| if (argument.contains("\'") || argument.contains(" ") | |||
| // WIN9x uses a bat file for executing commands | |||
| || (IS_WIN_9X && argument.indexOf(';') != -1)) { | |||
| return '\"' + argument + '\"'; | |||
| @@ -597,7 +597,7 @@ public class FilterSet extends DataType implements Cloneable { | |||
| } | |||
| passedTokens.addElement(parent); | |||
| String value = iReplaceTokens(line); | |||
| if (value.indexOf(beginToken) == -1 && !duplicateToken | |||
| if (!value.contains(beginToken) && !duplicateToken | |||
| && recurseDepth == 1) { | |||
| passedTokens = null; | |||
| } else if (duplicateToken) { | |||
| @@ -608,7 +608,7 @@ public class Path extends DataType implements Cloneable, ResourceCollection { | |||
| addExisting(systemBootClasspath); | |||
| } | |||
| if (System.getProperty("java.vendor").toLowerCase(Locale.ENGLISH).indexOf("microsoft") >= 0) { | |||
| if (System.getProperty("java.vendor").toLowerCase(Locale.ENGLISH).contains("microsoft")) { | |||
| // TODO is this code still necessary? is there any 1.2+ port? | |||
| // Pull in *.zip from packages directory | |||
| FileSet msZipFiles = new FileSet(); | |||
| @@ -186,7 +186,7 @@ public class ContainsSelector extends BaseExtendSelector implements ResourceSele | |||
| if (ignorewhitespace) { | |||
| teststr = SelectorUtils.removeWhitespace(teststr); | |||
| } | |||
| if (teststr.indexOf(userstr) > -1) { | |||
| if (teststr.contains(userstr)) { | |||
| return true; | |||
| } | |||
| teststr = in.readLine(); | |||
| @@ -119,7 +119,7 @@ public class RegexpPatternMapper implements FileNameMapper { | |||
| return null; | |||
| } | |||
| if (handleDirSep) { | |||
| if (sourceFileName.indexOf("\\") != -1) { | |||
| if (sourceFileName.contains("\\")) { | |||
| sourceFileName = sourceFileName.replace('\\', '/'); | |||
| } | |||
| } | |||
| @@ -1042,7 +1042,7 @@ public class TarEntry implements TarConstants { | |||
| fileName = fileName.substring(2); | |||
| } | |||
| } | |||
| } else if (osname.indexOf("netware") > -1) { | |||
| } else if (osname.contains("netware")) { | |||
| int colon = fileName.indexOf(':'); | |||
| if (colon != -1) { | |||
| fileName = fileName.substring(colon + 1); | |||
| @@ -122,7 +122,7 @@ public abstract class BuildFileTest extends TestCase { | |||
| String realLog = getLog(); | |||
| assertTrue("expecting log to contain \"" + substring + "\" log was \"" | |||
| + realLog + "\"", | |||
| realLog.indexOf(substring) >= 0); | |||
| realLog.contains(substring)); | |||
| } | |||
| /** | |||
| @@ -134,7 +134,7 @@ public abstract class BuildFileTest extends TestCase { | |||
| String realLog = getLog(); | |||
| assertFalse("didn't expect log to contain \"" + substring + "\" log was \"" | |||
| + realLog + "\"", | |||
| realLog.indexOf(substring) >= 0); | |||
| realLog.contains(substring)); | |||
| } | |||
| /** | |||
| @@ -160,7 +160,7 @@ public abstract class BuildFileTest extends TestCase { | |||
| String realMessage = (message != null) | |||
| ? message | |||
| : "expecting output to contain \"" + substring + "\" output was \"" + realOutput + "\""; | |||
| assertTrue(realMessage, realOutput.indexOf(substring) >= 0); | |||
| assertTrue(realMessage, realOutput.contains(substring)); | |||
| } | |||
| /** | |||
| @@ -176,7 +176,7 @@ public abstract class BuildFileTest extends TestCase { | |||
| String realMessage = (message != null) | |||
| ? message | |||
| : "expecting output to not contain \"" + substring + "\" output was \"" + realOutput + "\""; | |||
| assertFalse(realMessage, realOutput.indexOf(substring) >= 0); | |||
| assertFalse(realMessage, realOutput.contains(substring)); | |||
| } | |||
| /** | |||
| @@ -237,7 +237,7 @@ public abstract class BuildFileTest extends TestCase { | |||
| assertTrue("expecting debug log to contain \"" + substring | |||
| + "\" log was \"" | |||
| + realLog + "\"", | |||
| realLog.indexOf(substring) >= 0); | |||
| realLog.contains(substring)); | |||
| } | |||
| /** | |||
| @@ -425,7 +425,7 @@ public abstract class BuildFileTest extends TestCase { | |||
| executeTarget(target); | |||
| } catch (org.apache.tools.ant.BuildException ex) { | |||
| buildException = ex; | |||
| if ((null != contains) && (ex.getMessage().indexOf(contains) == -1)) { | |||
| if ((null != contains) && (!ex.getMessage().contains(contains))) { | |||
| fail("Should throw BuildException because '" + cause + "' with message containing '" + contains + "' (actual message '" + ex.getMessage() + "' instead)"); | |||
| } | |||
| return; | |||
| @@ -70,18 +70,16 @@ public class LocationTest { | |||
| public void testMacrodefWrappedTask() { | |||
| buildRule.executeTarget("testMacrodefWrappedTask"); | |||
| Echo e = (Echo) buildRule.getProject().getReference("echo3"); | |||
| assertTrue(buildRule.getLog().indexOf("Line: " | |||
| + (e.getLocation().getLineNumber() + 1)) | |||
| > -1); | |||
| assertTrue(buildRule.getLog().contains("Line: " | |||
| + (e.getLocation().getLineNumber() + 1))); | |||
| } | |||
| @Test | |||
| public void testPresetdefWrappedTask() { | |||
| buildRule.executeTarget("testPresetdefWrappedTask"); | |||
| Echo e = (Echo) buildRule.getProject().getReference("echo4"); | |||
| assertTrue(buildRule.getLog().indexOf("Line: " | |||
| + (e.getLocation().getLineNumber() + 1)) | |||
| > -1); | |||
| assertTrue(buildRule.getLog().contains("Line: " | |||
| + (e.getLocation().getLineNumber() + 1))); | |||
| } | |||
| public static class EchoLocation extends Task { | |||
| @@ -38,29 +38,29 @@ public class TaskContainerTest { | |||
| public void testPropertyExpansion() { | |||
| buildRule.executeTarget("testPropertyExpansion"); | |||
| assertTrue("attribute worked", | |||
| buildRule.getLog().indexOf("As attribute: it worked") > -1); | |||
| buildRule.getLog().contains("As attribute: it worked")); | |||
| assertTrue("nested text worked", | |||
| buildRule.getLog().indexOf("As nested text: it worked") > -1); | |||
| buildRule.getLog().contains("As nested text: it worked")); | |||
| } | |||
| @Test | |||
| public void testTaskdef() { | |||
| buildRule.executeTarget("testTaskdef"); | |||
| assertTrue("attribute worked", | |||
| buildRule.getLog().indexOf("As attribute: it worked") > -1); | |||
| buildRule.getLog().contains("As attribute: it worked")); | |||
| assertTrue("nested text worked", | |||
| buildRule.getLog().indexOf("As nested text: it worked") > -1); | |||
| buildRule.getLog().contains("As nested text: it worked")); | |||
| assertTrue("nested text worked", | |||
| buildRule.getLog().indexOf("As nested task: it worked") > -1); | |||
| buildRule.getLog().contains("As nested task: it worked")); | |||
| } | |||
| @Test | |||
| public void testCaseInsensitive() { | |||
| buildRule.executeTarget("testCaseInsensitive"); | |||
| assertTrue("works outside of container", | |||
| buildRule.getLog().indexOf("hello ") > -1); | |||
| buildRule.getLog().contains("hello ")); | |||
| assertTrue("works inside of container", | |||
| buildRule.getLog().indexOf("world") > -1); | |||
| buildRule.getLog().contains("world")); | |||
| } | |||
| } | |||
| @@ -318,9 +318,9 @@ public class AntTest { | |||
| @Test | |||
| public void testPropertySet() { | |||
| buildRule.executeTarget("test-propertyset"); | |||
| assertTrue(buildRule.getLog().indexOf("test1 is ${test1}") > -1); | |||
| assertTrue(buildRule.getLog().indexOf("test2 is ${test2}") > -1); | |||
| assertTrue(buildRule.getLog().indexOf("test1.x is 1") > -1); | |||
| assertTrue(buildRule.getLog().contains("test1 is ${test1}")); | |||
| assertTrue(buildRule.getLog().contains("test2 is ${test2}")); | |||
| assertTrue(buildRule.getLog().contains("test1.x is 1")); | |||
| } | |||
| @Test | |||
| @@ -199,7 +199,7 @@ public class ConcatTest { | |||
| @Test | |||
| public void testFilter() { | |||
| buildRule.executeTarget("testfilter"); | |||
| assertTrue(buildRule.getLog().indexOf("REPLACED") > -1); | |||
| assertTrue(buildRule.getLog().contains("REPLACED")); | |||
| } | |||
| @Test | |||
| @@ -251,7 +251,7 @@ public class ConcatTest { | |||
| @Test | |||
| public void testfilterinline() { | |||
| buildRule.executeTarget("testfilterinline"); | |||
| assertTrue(buildRule.getLog().indexOf("REPLACED") > -1); | |||
| assertTrue(buildRule.getLog().contains("REPLACED")); | |||
| } | |||
| /** | |||
| @@ -260,8 +260,8 @@ public class ConcatTest { | |||
| @Test | |||
| public void testmultireader() { | |||
| buildRule.executeTarget("testmultireader"); | |||
| assertTrue(buildRule.getLog().indexOf("Bye") > -1); | |||
| assertTrue(buildRule.getLog().indexOf("Hello") == -1); | |||
| assertTrue(buildRule.getLog().contains("Bye")); | |||
| assertTrue(!buildRule.getLog().contains("Hello")); | |||
| } | |||
| /** | |||
| * Check if fixlastline works | |||
| @@ -302,7 +302,7 @@ public class ConcatTest { | |||
| assertTrue( | |||
| "expecting file " + filename + " to contain " + | |||
| contains + | |||
| " but got " + content, content.indexOf(contains) > -1); | |||
| " but got " + content, content.contains(contains)); | |||
| } | |||
| } | |||
| @@ -110,7 +110,7 @@ public class CopyTest { | |||
| @Test | |||
| public void testFilterTest() { | |||
| buildRule.executeTarget("filtertest"); | |||
| assertTrue(buildRule.getLog().indexOf("loop in tokens") == -1); | |||
| assertTrue(!buildRule.getLog().contains("loop in tokens")); | |||
| } | |||
| @Test | |||
| @@ -344,33 +344,33 @@ public class JarTest { | |||
| @Test | |||
| public void testNoVersionInfoIgnore() { | |||
| buildRule.executeTarget("testNoVersionInfoIgnore"); | |||
| assertTrue(buildRule.getFullLog().indexOf("No Implementation-Title set.") > -1); | |||
| assertTrue(buildRule.getFullLog().indexOf("No Implementation-Version set.") > -1); | |||
| assertTrue(buildRule.getFullLog().indexOf("No Implementation-Vendor set.") > -1); | |||
| assertTrue(buildRule.getFullLog().contains("No Implementation-Title set.")); | |||
| assertTrue(buildRule.getFullLog().contains("No Implementation-Version set.")); | |||
| assertTrue(buildRule.getFullLog().contains("No Implementation-Vendor set.")); | |||
| } | |||
| @Test | |||
| public void testNoVersionInfoWarn() { | |||
| buildRule.executeTarget("testNoVersionInfoWarn"); | |||
| assertTrue(buildRule.getLog().indexOf("No Implementation-Title set.") > -1); | |||
| assertTrue(buildRule.getLog().indexOf("No Implementation-Version set.") > -1); | |||
| assertTrue(buildRule.getLog().indexOf("No Implementation-Vendor set.") > -1); | |||
| assertTrue(buildRule.getLog().contains("No Implementation-Title set.")); | |||
| assertTrue(buildRule.getLog().contains("No Implementation-Version set.")); | |||
| assertTrue(buildRule.getLog().contains("No Implementation-Vendor set.")); | |||
| } | |||
| @Test | |||
| public void testNoVersionInfoNoStrict() { | |||
| buildRule.executeTarget("testNoVersionInfoNoStrict"); | |||
| assertFalse(buildRule.getLog().indexOf("No Implementation-Title set.") > -1); | |||
| assertFalse(buildRule.getLog().indexOf("No Implementation-Version set.") > -1); | |||
| assertFalse(buildRule.getLog().indexOf("No Implementation-Vendor set.") > -1); | |||
| assertFalse(buildRule.getLog().contains("No Implementation-Title set.")); | |||
| assertFalse(buildRule.getLog().contains("No Implementation-Version set.")); | |||
| assertFalse(buildRule.getLog().contains("No Implementation-Vendor set.")); | |||
| } | |||
| @Test | |||
| public void testHasVersionInfo() { | |||
| buildRule.executeTarget("testHasVersionInfo"); | |||
| assertFalse(buildRule.getLog().indexOf("No Implementation-Title set.") > -1); | |||
| assertFalse(buildRule.getLog().indexOf("No Implementation-Version set.") > -1); | |||
| assertFalse(buildRule.getLog().indexOf("No Implementation-Vendor set.") > -1); | |||
| assertFalse(buildRule.getLog().contains("No Implementation-Title set.")); | |||
| assertFalse(buildRule.getLog().contains("No Implementation-Version set.")); | |||
| assertFalse(buildRule.getLog().contains("No Implementation-Vendor set.")); | |||
| } | |||
| } | |||
| @@ -102,7 +102,7 @@ public class LoadFileTest { | |||
| @Test | |||
| public void testLoadAFile() throws BuildException { | |||
| buildRule.executeTarget("testLoadAFile"); | |||
| if(buildRule.getProject().getProperty("testLoadAFile").indexOf("eh?")<0) { | |||
| if(!buildRule.getProject().getProperty("testLoadAFile").contains("eh?")) { | |||
| fail("property is not all in the file"); | |||
| } | |||
| } | |||
| @@ -122,7 +122,7 @@ public class LoadFileTest { | |||
| @Test | |||
| public void testEvalProps() throws BuildException { | |||
| buildRule.executeTarget("testEvalProps"); | |||
| if(buildRule.getProject().getProperty("testEvalProps").indexOf("rain")<0) { | |||
| if(!buildRule.getProject().getProperty("testEvalProps").contains("rain")) { | |||
| fail("property eval broken"); | |||
| } | |||
| } | |||
| @@ -133,7 +133,7 @@ public class LoadFileTest { | |||
| @Test | |||
| public void testFilterChain() throws BuildException { | |||
| buildRule.executeTarget("testFilterChain"); | |||
| if(buildRule.getProject().getProperty("testFilterChain").indexOf("World!")<0) { | |||
| if(!buildRule.getProject().getProperty("testFilterChain").contains("World!")) { | |||
| fail("Filter Chain broken"); | |||
| } | |||
| } | |||
| @@ -188,7 +188,7 @@ public class MacroDefTest { | |||
| try { | |||
| buildRule.executeTarget("backtraceoff"); | |||
| } catch (BuildException ex) { | |||
| if (ex.getMessage().indexOf("following error occurred") != -1) { | |||
| if (ex.getMessage().contains("following error occurred")) { | |||
| fail("error message contained backtrace - " + ex.getMessage()); | |||
| } | |||
| } | |||
| @@ -161,7 +161,7 @@ public class MakeUrlTest { | |||
| String result = getProperty(property); | |||
| assertTrue("expected " + contains + " in " + result, | |||
| result != null && result.indexOf(contains) >= 0); | |||
| result != null && result.contains(contains)); | |||
| } | |||
| /** | |||
| @@ -395,14 +395,14 @@ public class ManifestTest { | |||
| String mfAsString = mf.toString(); | |||
| assertNotNull(mfAsString); | |||
| assertTrue(mfAsString.startsWith("Manifest-Version: 2.0")); | |||
| assertTrue(mfAsString.indexOf("Foo: Bar") > -1); | |||
| assertTrue(mfAsString.contains("Foo: Bar")); | |||
| mf = getManifest(new File(outDir, "mftest2.mf")); | |||
| assertNotNull(mf); | |||
| mfAsString = mf.toString(); | |||
| assertNotNull(mfAsString); | |||
| assertEquals(-1, mfAsString.indexOf("Foo: Bar")); | |||
| assertTrue(mfAsString.indexOf("Foo: Baz") > -1); | |||
| assertTrue(mfAsString.contains("Foo: Baz")); | |||
| } | |||
| @Test | |||
| @@ -68,7 +68,7 @@ public class PropertyTest { | |||
| fail("Did not throw exception on circular exception"); | |||
| } catch (BuildException e) { | |||
| assertTrue("Circular definition not detected - ", | |||
| e.getMessage().indexOf("was circularly defined") != -1); | |||
| e.getMessage().contains("was circularly defined")); | |||
| } | |||
| } | |||
| @@ -90,7 +90,7 @@ public class SQLExecTest { | |||
| try { | |||
| sql.execute(); | |||
| } catch (BuildException e){ | |||
| assertTrue(e.getCause().getMessage().indexOf("No suitable Driver") != -1); | |||
| assertTrue(e.getCause().getMessage().contains("No suitable Driver")); | |||
| } | |||
| assertTrue(JDBCTask.getLoaderMap().containsKey(NULL_DRIVER)); | |||
| assertSame(sql.getLoader(), JDBCTask.getLoaderMap().get(NULL_DRIVER)); | |||
| @@ -232,7 +232,7 @@ public class StyleTest { | |||
| "expecting file " + filename | |||
| + " to contain " + contains | |||
| + " but got " + content, | |||
| content.indexOf(contains) > -1); | |||
| content.contains(contains)); | |||
| } | |||
| } | |||
| @@ -41,7 +41,7 @@ public class SyncTest { | |||
| buildRule.executeTarget("simplecopy"); | |||
| String d = buildRule.getProject().getProperty("dest") + "/a/b/c/d"; | |||
| assertFileIsPresent(d); | |||
| assertTrue(buildRule.getFullLog().indexOf("dangling") == -1); | |||
| assertTrue(!buildRule.getFullLog().contains("dangling")); | |||
| } | |||
| @Test | |||
| @@ -51,7 +51,7 @@ public class SyncTest { | |||
| assertFileIsNotPresent(d); | |||
| String c = buildRule.getProject().getProperty("dest") + "/a/b/c"; | |||
| assertFileIsNotPresent(c); | |||
| assertTrue(buildRule.getFullLog().indexOf("dangling") == -1); | |||
| assertTrue(!buildRule.getFullLog().contains("dangling")); | |||
| } | |||
| @Test | |||
| @@ -61,7 +61,7 @@ public class SyncTest { | |||
| assertFileIsNotPresent(d); | |||
| String c = buildRule.getProject().getProperty("dest") + "/a/b/c"; | |||
| assertFileIsPresent(c); | |||
| assertTrue(buildRule.getFullLog().indexOf("dangling") == -1); | |||
| assertTrue(!buildRule.getFullLog().contains("dangling")); | |||
| } | |||
| @Test | |||
| @@ -85,7 +85,7 @@ public class SyncTest { | |||
| assertFileIsPresent(d); | |||
| String f = buildRule.getProject().getProperty("dest") + "/e/f"; | |||
| assertFileIsNotPresent(f); | |||
| assertTrue(buildRule.getFullLog().indexOf("Removing orphan file:") > -1); | |||
| assertTrue(buildRule.getFullLog().contains("Removing orphan file:")); | |||
| assertContains("Removed 1 dangling file from", buildRule.getFullLog()); | |||
| assertContains("Removed 1 dangling directory from", buildRule.getFullLog()); | |||
| } | |||
| @@ -97,7 +97,7 @@ public class SyncTest { | |||
| assertFileIsPresent(d); | |||
| String f = buildRule.getProject().getProperty("dest") + "/e/f"; | |||
| assertFileIsNotPresent(f); | |||
| assertTrue(buildRule.getFullLog().indexOf("Removing orphan file:") > -1); | |||
| assertTrue(buildRule.getFullLog().contains("Removing orphan file:")); | |||
| assertContains("Removed 1 dangling file from", buildRule.getFullLog()); | |||
| assertContains("Removed 1 dangling directory from", buildRule.getFullLog()); | |||
| } | |||
| @@ -111,7 +111,7 @@ public class SyncTest { | |||
| assertFileIsPresent(c); | |||
| String f = buildRule.getProject().getProperty("dest") + "/e/f"; | |||
| assertFileIsNotPresent(f); | |||
| assertTrue(buildRule.getFullLog().indexOf("Removing orphan directory:") > -1); | |||
| assertTrue(buildRule.getFullLog().contains("Removing orphan directory:")); | |||
| assertContains("NO dangling file to remove from", buildRule.getFullLog()); | |||
| assertContains("Removed 2 dangling directories from", buildRule.getFullLog()); | |||
| } | |||
| @@ -123,7 +123,7 @@ public class SyncTest { | |||
| assertFileIsPresent(d); | |||
| String f = buildRule.getProject().getProperty("dest") + "/e/f"; | |||
| assertFileIsPresent(f); | |||
| assertTrue(buildRule.getFullLog().indexOf("Removing orphan file:") == -1); | |||
| assertTrue(!buildRule.getFullLog().contains("Removing orphan file:")); | |||
| } | |||
| @Test | |||
| @@ -133,7 +133,7 @@ public class SyncTest { | |||
| assertFileIsPresent(d); | |||
| String f = buildRule.getProject().getProperty("dest") + "/e/f"; | |||
| assertFileIsPresent(f); | |||
| assertTrue(buildRule.getFullLog().indexOf("Removing orphan file:") == -1); | |||
| assertTrue(!buildRule.getFullLog().contains("Removing orphan file:")); | |||
| } | |||
| public void assertFileIsPresent(String f) { | |||
| @@ -119,10 +119,10 @@ public class TaskdefTest { | |||
| buildRule.executeTarget("testOverride"); | |||
| String log = buildRule.getLog(); | |||
| assertTrue("override warning sent", | |||
| log.indexOf("Trying to override old definition of task copy") > -1); | |||
| log.contains("Trying to override old definition of task copy")); | |||
| assertTrue("task inside target worked", | |||
| log.indexOf("In target") > -1); | |||
| log.contains("In target")); | |||
| assertTrue("task inside target worked", | |||
| log.indexOf("In TaskContainer") > -1); | |||
| log.contains("In TaskContainer")); | |||
| } | |||
| } | |||
| @@ -131,7 +131,7 @@ public class EchoPropertiesTest { | |||
| try { | |||
| String read = null; | |||
| while ((read = br.readLine()) != null) { | |||
| if (read.indexOf("<property name=\"test.property\" value=\""+TEST_VALUE+"\" />") >= 0) { | |||
| if (read.contains("<property name=\"test.property\" value=\"" + TEST_VALUE + "\" />")) { | |||
| // found the property we set - it's good. | |||
| return; | |||
| } | |||
| @@ -137,7 +137,7 @@ public class XmlValidateTest { | |||
| throw new AssumptionViolatedException("parser doesn't support schema"); | |||
| } else { | |||
| assertTrue( | |||
| e.getMessage().indexOf("not a valid XML document") > -1); | |||
| e.getMessage().contains("not a valid XML document")); | |||
| } | |||
| } | |||
| } | |||
| @@ -77,7 +77,7 @@ public class XsltTest { | |||
| @Test | |||
| public void testStyleSheetWithInclude() throws Exception { | |||
| buildRule.executeTarget("testStyleSheetWithInclude"); | |||
| if (buildRule.getLog().indexOf("java.io.FileNotFoundException") != -1) { | |||
| if (buildRule.getLog().contains("java.io.FileNotFoundException")) { | |||
| fail("xsl:include was not found"); | |||
| } | |||
| } | |||
| @@ -116,7 +116,7 @@ public class ImageTest { | |||
| } catch (RuntimeException re){ | |||
| assertTrue("Run time exception should say 'Unable to process image stream'. :" | |||
| + re.toString(), | |||
| re.toString().indexOf("Unable to process image stream") > -1); | |||
| re.toString().contains("Unable to process image stream")); | |||
| } | |||
| } | |||
| @@ -80,7 +80,7 @@ public class JUnitTestRunnerTest { | |||
| runner.run(); | |||
| String error = runner.getFormatter().getError(); | |||
| assertEquals(error, JUnitTestRunner.ERRORS, runner.getRetCode()); | |||
| assertTrue(error, error.indexOf("thrown on purpose") != -1); | |||
| assertTrue(error, error.contains("thrown on purpose")); | |||
| } | |||
| // check that something which is not a testcase generates no errors | |||
| @@ -56,10 +56,10 @@ public class ScriptDefTest { | |||
| File baseDir = fileset.getDir(p); | |||
| String log = buildRule.getLog(); | |||
| assertTrue("Expecting attribute value printed", | |||
| log.indexOf("Attribute attr1 = test") != -1); | |||
| log.contains("Attribute attr1 = test")); | |||
| assertTrue("Expecting nested element value printed", | |||
| log.indexOf("Fileset basedir = " + baseDir.getAbsolutePath()) != -1); | |||
| log.contains("Fileset basedir = " + baseDir.getAbsolutePath())); | |||
| } | |||
| @Test | |||
| @@ -91,10 +91,10 @@ public class ScriptDefTest { | |||
| File baseDir = fileset.getDir(p); | |||
| String log = buildRule.getLog(); | |||
| assertTrue("Expecting attribute value to be printed", | |||
| log.indexOf("Attribute attr1 = test") != -1); | |||
| log.contains("Attribute attr1 = test")); | |||
| assertTrue("Expecting nested element value to be printed", | |||
| log.indexOf("Fileset basedir = " + baseDir.getAbsolutePath()) != -1); | |||
| log.contains("Fileset basedir = " + baseDir.getAbsolutePath())); | |||
| } | |||
| @Test | |||
| @@ -117,8 +117,8 @@ public class ScriptDefTest { | |||
| public void testDoubleDef() { | |||
| buildRule.executeTarget("doubledef"); | |||
| String log = buildRule.getLog(); | |||
| assertTrue("Task1 did not execute", log.indexOf("Task1") != -1); | |||
| assertTrue("Task2 did not execute", log.indexOf("Task2") != -1); | |||
| assertTrue("Task1 did not execute", log.contains("Task1")); | |||
| assertTrue("Task2 did not execute", log.contains("Task2")); | |||
| } | |||
| @Test | |||
| @@ -137,7 +137,7 @@ public class ScriptDefTest { | |||
| // get the fileset and its basedir | |||
| String log = buildRule.getLog(); | |||
| assertTrue("Expecting property in attribute value replaced", | |||
| log.indexOf("Attribute value = test") != -1); | |||
| log.contains("Attribute value = test")); | |||
| } | |||
| @Test | |||
| @@ -94,7 +94,7 @@ public class CommandlineJavaTest { | |||
| assertEquals("with classpath", "-Djava.compiler=NONE", s[1]); | |||
| assertEquals("with classpath", "-classpath", s[2]); | |||
| assertTrue("build.xml contained", | |||
| s[3].indexOf("build.xml"+java.io.File.pathSeparator) >= 0); | |||
| s[3].contains("build.xml" + java.io.File.pathSeparator)); | |||
| assertTrue("ant.jar contained", s[3].endsWith("ant.jar")); | |||
| assertEquals("with classpath", "junit.textui.TestRunner", s[4]); | |||
| assertEquals("with classpath", | |||
| @@ -572,7 +572,7 @@ public class PathTest { | |||
| assertEquals(0, p.list().length); | |||
| } catch (BuildException x) { | |||
| String m = x.toString(); | |||
| assertTrue(m, m.indexOf("circular") != -1); | |||
| assertTrue(m, m.contains("circular")); | |||
| } | |||
| } | |||
| @@ -73,7 +73,7 @@ public class RedirectorElementTest { | |||
| @Test | |||
| public void testLogInputString() { | |||
| buildRule.executeTarget("testLogInputString"); | |||
| if (buildRule.getLog().indexOf("testLogInputString can-cat") >= 0) { | |||
| if (buildRule.getLog().contains("testLogInputString can-cat")) { | |||
| AntAssert.assertContains("Using input string", buildRule.getFullLog()); | |||
| } | |||
| } | |||
| @@ -185,7 +185,7 @@ public class ModifiedSelectorTest { | |||
| assertNotNull("'fs.full.value' must be set.", fsFullValue); | |||
| assertTrue("'fs.full.value' must not be null.", !"".equals(fsFullValue)); | |||
| assertTrue("'fs.full.value' must contain ant.bat.", fsFullValue.indexOf("ant.bat")>-1); | |||
| assertTrue("'fs.full.value' must contain ant.bat.", fsFullValue.contains("ant.bat")); | |||
| assertNotNull("'fs.mod.value' must be set.", fsModValue); | |||
| // must be empty according to the Mock* implementations | |||
| @@ -59,8 +59,8 @@ public class LayoutPreservingPropertiesTest { | |||
| // and now make sure that the comments made it into the new file | |||
| String s = readFile(tmp); | |||
| assertTrue("missing comment", s.indexOf("# a comment") > -1); | |||
| assertTrue("missing comment", s.indexOf("! more comment") > -1); | |||
| assertTrue("missing comment", s.contains("# a comment")); | |||
| assertTrue("missing comment", s.contains("! more comment")); | |||
| } | |||
| /** | |||
| @@ -89,16 +89,16 @@ public class LayoutPreservingPropertiesTest { | |||
| // and check that the resulting file looks okay | |||
| String s = readFile(tmp); | |||
| assertTrue(s.indexOf("\\ prop\\ one\\ =\\ \\ leading and trailing" | |||
| + " spaces ") > -1); | |||
| assertTrue(s.indexOf("prop\\ttwo=contains\\ttab") > -1); | |||
| assertTrue(s.indexOf("prop\\nthree=contains\\nnewline") > -1); | |||
| assertTrue(s.indexOf("prop\\rfour=contains\\rcarriage return") > -1); | |||
| assertTrue(s.indexOf("prop\\\\six=contains\\\\backslash") > -1); | |||
| assertTrue(s.indexOf("prop\\:seven=contains\\:colon") > -1); | |||
| assertTrue(s.indexOf("prop\\=eight=contains\\=equals") > -1); | |||
| assertTrue(s.indexOf("prop\\#nine=contains\\#hash") > -1); | |||
| assertTrue(s.indexOf("prop\\!ten=contains\\!exclamation") > -1); | |||
| assertTrue(s.contains("\\ prop\\ one\\ =\\ \\ leading and trailing" | |||
| + " spaces ")); | |||
| assertTrue(s.contains("prop\\ttwo=contains\\ttab")); | |||
| assertTrue(s.contains("prop\\nthree=contains\\nnewline")); | |||
| assertTrue(s.contains("prop\\rfour=contains\\rcarriage return")); | |||
| assertTrue(s.contains("prop\\\\six=contains\\\\backslash")); | |||
| assertTrue(s.contains("prop\\:seven=contains\\:colon")); | |||
| assertTrue(s.contains("prop\\=eight=contains\\=equals")); | |||
| assertTrue(s.contains("prop\\#nine=contains\\#hash")); | |||
| assertTrue(s.contains("prop\\!ten=contains\\!exclamation")); | |||
| } | |||
| /** | |||
| @@ -125,13 +125,13 @@ public class LayoutPreservingPropertiesTest { | |||
| // and check that the resulting file looks okay | |||
| String s = readFile(tmp); | |||
| assertTrue(s.indexOf("\\ prop\\ one\\ =\\ \\ leading and" | |||
| + " trailing spaces ") == -1); | |||
| assertTrue(s.indexOf("\\ prop\\ one\\ =new one") > -1); | |||
| assertTrue(s.indexOf("prop\\ttwo=contains\\ttab") == -1); | |||
| assertTrue(s.indexOf("prop\\ttwo=new two") > -1); | |||
| assertTrue(s.indexOf("prop\\nthree=contains\\nnewline") == -1); | |||
| assertTrue(s.indexOf("prop\\nthree=new three") > -1); | |||
| assertTrue(!s.contains("\\ prop\\ one\\ =\\ \\ leading and" | |||
| + " trailing spaces ")); | |||
| assertTrue(s.contains("\\ prop\\ one\\ =new one")); | |||
| assertTrue(!s.contains("prop\\ttwo=contains\\ttab")); | |||
| assertTrue(s.contains("prop\\ttwo=new two")); | |||
| assertTrue(!s.contains("prop\\nthree=contains\\nnewline")); | |||
| assertTrue(s.contains("prop\\nthree=new three")); | |||
| } | |||
| @Test | |||
| @@ -172,18 +172,18 @@ public class LayoutPreservingPropertiesTest { | |||
| String s = readFile(tmp); | |||
| assertTrue("should have had no properties ", | |||
| s.indexOf("prop.alpha") == -1); | |||
| !s.contains("prop.alpha")); | |||
| assertTrue("should have had no properties ", | |||
| s.indexOf("prop.beta") == -1); | |||
| !s.contains("prop.beta")); | |||
| assertTrue("should have had no properties ", | |||
| s.indexOf("prop.gamma") == -1); | |||
| !s.contains("prop.gamma")); | |||
| assertTrue("should have had no comments", | |||
| s.indexOf("# a comment") == -1); | |||
| !s.contains("# a comment")); | |||
| assertTrue("should have had no comments", | |||
| s.indexOf("! more comment") == -1); | |||
| !s.contains("! more comment")); | |||
| assertTrue("should have had no comments", | |||
| s.indexOf("# now a line wrapping one") == -1); | |||
| !s.contains("# now a line wrapping one")); | |||
| } | |||
| @Test | |||
| @@ -204,9 +204,9 @@ public class LayoutPreservingPropertiesTest { | |||
| String s = readFile(tmp); | |||
| assertTrue("should not have had prop.beta", | |||
| s.indexOf("prop.beta") == -1); | |||
| !s.contains("prop.beta")); | |||
| assertTrue("should have had prop.beta's comment", | |||
| s.indexOf("! more comment") > -1); | |||
| s.contains("! more comment")); | |||
| } | |||
| @Test | |||
| @@ -229,9 +229,9 @@ public class LayoutPreservingPropertiesTest { | |||
| String s = readFile(tmp); | |||
| assertTrue("should not have had prop.beta", | |||
| s.indexOf("prop.beta") == -1); | |||
| !s.contains("prop.beta")); | |||
| assertTrue("should not have had prop.beta's comment", | |||
| s.indexOf("! more comment") == -1); | |||
| !s.contains("! more comment")); | |||
| } | |||
| @Test | |||
| @@ -262,13 +262,13 @@ public class LayoutPreservingPropertiesTest { | |||
| String s2 = readFile(tmp2); | |||
| // check original is untouched | |||
| assertTrue("should have had 'simple'", s1.indexOf("simple") > -1); | |||
| assertTrue("should not have had prop.new", s1.indexOf("prop.new") == -1); | |||
| assertTrue("should have had 'simple'", s1.contains("simple")); | |||
| assertTrue("should not have had prop.new", !s1.contains("prop.new")); | |||
| // check clone has the changes | |||
| assertTrue("should have had 'a new value for beta'", | |||
| s2.indexOf("a new value for beta") > -1); | |||
| assertTrue("should have had prop.new", s2.indexOf("prop.new") > -1); | |||
| s2.contains("a new value for beta")); | |||
| assertTrue("should have had prop.new", s2.contains("prop.new")); | |||
| } | |||
| @Test | |||
| @@ -293,16 +293,16 @@ public class LayoutPreservingPropertiesTest { | |||
| // and check that the resulting file looks okay | |||
| String s = readFile(tmp); | |||
| assertTrue(s.indexOf("prop\\:seven=new value for seven") > -1); | |||
| assertTrue(s.indexOf("prop\\=eight=new value for eight") > -1); | |||
| assertTrue(s.indexOf("prop\\ eleven=new value for eleven") > -1); | |||
| assertTrue(s.indexOf("alpha=new value for alpha") > -1); | |||
| assertTrue(s.indexOf("beta=new value for beta") > -1); | |||
| assertTrue(s.contains("prop\\:seven=new value for seven")); | |||
| assertTrue(s.contains("prop\\=eight=new value for eight")); | |||
| assertTrue(s.contains("prop\\ eleven=new value for eleven")); | |||
| assertTrue(s.contains("alpha=new value for alpha")); | |||
| assertTrue(s.contains("beta=new value for beta")); | |||
| assertTrue(s.indexOf("prop\\:seven=contains\\:colon") == -1); | |||
| assertTrue(s.indexOf("prop\\=eight=contains\\=equals") == -1); | |||
| assertTrue(s.indexOf("alpha:set with a colon") == -1); | |||
| assertTrue(s.indexOf("beta set with a space") == -1); | |||
| assertTrue(!s.contains("prop\\:seven=contains\\:colon")); | |||
| assertTrue(!s.contains("prop\\=eight=contains\\=equals")); | |||
| assertTrue(!s.contains("alpha:set with a colon")); | |||
| assertTrue(!s.contains("beta set with a space")); | |||
| } | |||
| private static String readFile(File f) throws IOException { | |||