Browse Source

Statically import string contains assertions

master
Gintas Grigelionis 7 years ago
parent
commit
cdb0348e9d
16 changed files with 76 additions and 73 deletions
  1. +3
    -3
      src/tests/junit/org/apache/tools/ant/taskdefs/AbstractCvsTaskTest.java
  2. +5
    -5
      src/tests/junit/org/apache/tools/ant/taskdefs/AntTest.java
  3. +3
    -3
      src/tests/junit/org/apache/tools/ant/taskdefs/CallTargetTest.java
  4. +2
    -2
      src/tests/junit/org/apache/tools/ant/taskdefs/FixCrLfTest.java
  5. +8
    -7
      src/tests/junit/org/apache/tools/ant/taskdefs/GetTest.java
  6. +2
    -2
      src/tests/junit/org/apache/tools/ant/taskdefs/RmicAdvancedTest.java
  7. +3
    -3
      src/tests/junit/org/apache/tools/ant/taskdefs/condition/IsFileSelectedTest.java
  8. +3
    -3
      src/tests/junit/org/apache/tools/ant/taskdefs/condition/IsReachableTest.java
  9. +3
    -3
      src/tests/junit/org/apache/tools/ant/taskdefs/condition/TypeFoundTest.java
  10. +6
    -6
      src/tests/junit/org/apache/tools/ant/taskdefs/optional/SchemaValidateTest.java
  11. +9
    -9
      src/tests/junit/org/apache/tools/ant/taskdefs/optional/image/ImageTest.java
  12. +8
    -7
      src/tests/junit/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTest.java
  13. +11
    -11
      src/tests/junit/org/apache/tools/ant/types/AddTypeTest.java
  14. +6
    -5
      src/tests/junit/org/apache/tools/ant/types/PolyTest.java
  15. +2
    -2
      src/tests/junit/org/apache/tools/ant/types/RedirectorElementTest.java
  16. +2
    -2
      src/tests/junit/org/apache/tools/ant/types/selectors/ModifiedSelectorTest.java

+ 3
- 3
src/tests/junit/org/apache/tools/ant/taskdefs/AbstractCvsTaskTest.java View File

@@ -17,7 +17,6 @@
*/
package org.apache.tools.ant.taskdefs;

import org.apache.tools.ant.AntAssert;
import org.apache.tools.ant.BuildFileRule;
import org.junit.After;
import org.junit.Before;
@@ -26,6 +25,7 @@ import org.junit.Test;

import java.io.File;

import static org.apache.tools.ant.AntAssert.assertContains;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

@@ -57,7 +57,7 @@ public class AbstractCvsTaskTest {
File f = new File(buildRule.getProject().getProperty("output") + "/src/Makefile");
assertFalse("starting empty", f.exists());
buildRule.executeTarget("package-attribute");
AntAssert.assertContains("U src/Makefile", buildRule.getLog());
assertContains("U src/Makefile", buildRule.getLog());
assertTrue("now it is there", f.exists());
}

@@ -66,7 +66,7 @@ public class AbstractCvsTaskTest {
File f = new File(buildRule.getProject().getProperty("output") + "/src/Makefile");
assertFalse("starting empty", f.exists());
buildRule.executeTarget("tag-attribute");
AntAssert.assertContains("OPENBSD_5_3", buildRule.getLog());
assertContains("OPENBSD_5_3", buildRule.getLog());
assertTrue("now it is there", f.exists());
}
}

+ 5
- 5
src/tests/junit/org/apache/tools/ant/taskdefs/AntTest.java View File

@@ -22,7 +22,6 @@ import java.io.File;

import junit.framework.AssertionFailedError;

import org.apache.tools.ant.AntAssert;
import org.apache.tools.ant.BuildEvent;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.BuildFileRule;
@@ -35,6 +34,7 @@ import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;

import static org.apache.tools.ant.AntAssert.assertContains;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
@@ -290,7 +290,7 @@ public class AntTest {
buildRule.getProject().setUserProperty("test", "7");
buildRule.executeTarget("test-property-override-inheritall-start");

AntAssert.assertContains("The value of test is 7", buildRule.getLog());
assertContains("The value of test is 7", buildRule.getLog());
}

@Test
@@ -298,20 +298,20 @@ public class AntTest {
buildRule.getProject().setUserProperty("test", "7");
buildRule.executeTarget("test-property-override-no-inheritall-start");

AntAssert.assertContains("The value of test is 7", buildRule.getLog());
assertContains("The value of test is 7", buildRule.getLog());
}

@Test
public void testOverrideWinsInheritAll() {
buildRule.executeTarget("test-property-override-inheritall-start");

AntAssert.assertContains("The value of test is 4", buildRule.getLog());
assertContains("The value of test is 4", buildRule.getLog());
}

@Test
public void testOverrideWinsNoInheritAll() {
buildRule.executeTarget("test-property-override-no-inheritall-start");
AntAssert.assertContains("The value of test is 4", buildRule.getLog());
assertContains("The value of test is 4", buildRule.getLog());
}

@Test


+ 3
- 3
src/tests/junit/org/apache/tools/ant/taskdefs/CallTargetTest.java View File

@@ -18,7 +18,6 @@

package org.apache.tools.ant.taskdefs;

import org.apache.tools.ant.AntAssert;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.BuildFileRule;
import org.junit.Before;
@@ -27,6 +26,7 @@ import org.junit.Test;

import java.util.Vector;

import static org.apache.tools.ant.AntAssert.assertContains;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;

@@ -47,7 +47,7 @@ public class CallTargetTest {
@Test
public void testInheritRefFileSet() {
buildRule.executeTarget("testinheritreffileset");
AntAssert.assertContains("calltarget.xml", buildRule.getLog());
assertContains("calltarget.xml", buildRule.getLog());
}

// see bugrep 21724 (references not passing through with antcall)
@@ -64,7 +64,7 @@ public class CallTargetTest {
v.add("call-multi");
v.add("call-multi");
buildRule.getProject().executeTargets(v);
AntAssert.assertContains("multi is SETmulti is SET", buildRule.getLog());
assertContains("multi is SETmulti is SET", buildRule.getLog());
}

@Test


+ 2
- 2
src/tests/junit/org/apache/tools/ant/taskdefs/FixCrLfTest.java View File

@@ -26,13 +26,13 @@ import java.io.InputStream;

import junit.framework.AssertionFailedError;

import org.apache.tools.ant.AntAssert;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.BuildFileRule;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;

import static org.apache.tools.ant.AntAssert.assertContains;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;

@@ -154,7 +154,7 @@ public class FixCrLfTest {
buildRule.executeTarget("testFixFileExclusive");
fail(FixCRLF.ERROR_FILE_AND_SRCDIR);
} catch (BuildException ex) {
AntAssert.assertContains(FixCRLF.ERROR_FILE_AND_SRCDIR, ex.getMessage());
assertContains(FixCRLF.ERROR_FILE_AND_SRCDIR, ex.getMessage());
}
}



+ 8
- 7
src/tests/junit/org/apache/tools/ant/taskdefs/GetTest.java View File

@@ -18,7 +18,6 @@

package org.apache.tools.ant.taskdefs;

import org.apache.tools.ant.AntAssert;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.BuildFileRule;
import org.junit.After;
@@ -26,6 +25,8 @@ import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;

import static org.apache.tools.ant.AntAssert.assertContains;
import static org.apache.tools.ant.AntAssert.assertNotContains;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;

@@ -105,7 +106,7 @@ public class GetTest {
public void test7() {
try {
buildRule.executeTarget("test7");
AntAssert.assertNotContains("Adding header", buildRule.getLog());
assertNotContains("Adding header", buildRule.getLog());

fail("userAgent may not be null or empty");
} catch (BuildException ex) {
@@ -127,21 +128,21 @@ public class GetTest {
public void testTwoHeadersAreAddedOK() {
buildRule.executeTarget("testTwoHeadersAreAddedOK");
String log = buildRule.getLog();
AntAssert.assertContains("Adding header 'header1'", log);
AntAssert.assertContains("Adding header 'header2'", log);
assertContains("Adding header 'header1'", log);
assertContains("Adding header 'header2'", log);
}

@Test
public void testEmptyHeadersAreNeverAdded() {
buildRule.executeTarget("testEmptyHeadersAreNeverAdded");
AntAssert.assertNotContains("Adding header", buildRule.getLog());
assertNotContains("Adding header", buildRule.getLog());
}

@Test
public void testThatWhenMoreThanOneHeaderHaveSameNameOnlyLastOneIsAdded() {
buildRule.executeTarget("testThatWhenMoreThanOneHeaderHaveSameNameOnlyLastOneIsAdded");
String log = buildRule.getLog();
AntAssert.assertContains("Adding header 'header1'", log);
assertContains("Adding header 'header1'", log);

int actualHeaderCount = log.split("Adding header ").length - 1;

@@ -151,7 +152,7 @@ public class GetTest {
@Test
public void testHeaderSpaceTrimmed() {
buildRule.executeTarget("testHeaderSpaceTrimmed");
AntAssert.assertContains("Adding header 'header1'", buildRule.getLog());
assertContains("Adding header 'header1'", buildRule.getLog());
}

}

+ 2
- 2
src/tests/junit/org/apache/tools/ant/taskdefs/RmicAdvancedTest.java View File

@@ -19,7 +19,6 @@

package org.apache.tools.ant.taskdefs;

import org.apache.tools.ant.AntAssert;
import org.apache.tools.ant.BuildFileRule;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.taskdefs.rmic.RmicAdapterFactory;
@@ -31,6 +30,7 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

import static org.apache.tools.ant.AntAssert.assertContains;
import static org.junit.Assume.assumeFalse;
import static org.junit.Assume.assumeTrue;

@@ -236,7 +236,7 @@ public class RmicAdvancedTest {
buildRule.executeTarget("testDefaultBadClass");
} finally {
// don't look for much text here as it is vendor and version dependent
AntAssert.assertContains("unimplemented.class", buildRule.getLog());
assertContains("unimplemented.class", buildRule.getLog());
}
}



+ 3
- 3
src/tests/junit/org/apache/tools/ant/taskdefs/condition/IsFileSelectedTest.java View File

@@ -18,13 +18,13 @@

package org.apache.tools.ant.taskdefs.condition;

import org.apache.tools.ant.AntAssert;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.BuildFileRule;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;

import static org.apache.tools.ant.AntAssert.assertContains;
import static org.junit.Assert.fail;

/**
@@ -66,8 +66,8 @@ public class IsFileSelectedTest {
try {
buildRule.executeTarget("not.selector");
fail("Exception should have been thrown: checking for use as a selector (not allowed)");
} catch(BuildException ex) {
AntAssert.assertContains("fileset doesn't support the nested \"isfile",
} catch (BuildException ex) {
assertContains("fileset doesn't support the nested \"isfile",
ex.getMessage());
}
}


+ 3
- 3
src/tests/junit/org/apache/tools/ant/taskdefs/condition/IsReachableTest.java View File

@@ -17,7 +17,6 @@
*/
package org.apache.tools.ant.taskdefs.condition;

import org.apache.tools.ant.AntAssert;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.BuildFileRule;
import org.junit.Before;
@@ -25,6 +24,7 @@ import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;

import static org.apache.tools.ant.AntAssert.assertContains;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;

@@ -108,8 +108,8 @@ public class IsReachableTest {
try {
buildRule.executeTarget("testBadURL");
fail("Build exception expected: error in URL");
} catch(BuildException ex) {
AntAssert.assertContains(IsReachable.ERROR_BAD_URL, ex.getMessage());
} catch (BuildException ex) {
assertContains(IsReachable.ERROR_BAD_URL, ex.getMessage());
}
}
}

+ 3
- 3
src/tests/junit/org/apache/tools/ant/taskdefs/condition/TypeFoundTest.java View File

@@ -17,13 +17,13 @@
*/
package org.apache.tools.ant.taskdefs.condition;

import org.apache.tools.ant.AntAssert;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.BuildFileRule;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;

import static org.apache.tools.ant.AntAssert.assertContains;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import static org.junit.Assert.assertNull;
@@ -52,8 +52,8 @@ public class TypeFoundTest {
try {
buildRule.executeTarget("testUndefined");
fail("Build exception expected: left out the name attribute");
} catch(BuildException ex) {
AntAssert.assertContains("No type specified", ex.getMessage());
} catch (BuildException ex) {
assertContains("No type specified", ex.getMessage());
}
}



+ 6
- 6
src/tests/junit/org/apache/tools/ant/taskdefs/optional/SchemaValidateTest.java View File

@@ -17,13 +17,13 @@
*/
package org.apache.tools.ant.taskdefs.optional;

import org.apache.tools.ant.AntAssert;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.BuildFileRule;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;

import static org.apache.tools.ant.AntAssert.assertContains;
import static org.junit.Assert.fail;

/**
@@ -67,7 +67,7 @@ public class SchemaValidateTest {
buildRule.executeTarget("testNoEmptySchemaNamespace");
fail("Empty namespace URI");
} catch (BuildException ex) {
AntAssert.assertContains(SchemaValidate.SchemaLocation.ERROR_NO_URI, ex.getMessage());
assertContains(SchemaValidate.SchemaLocation.ERROR_NO_URI, ex.getMessage());
}
}

@@ -77,7 +77,7 @@ public class SchemaValidateTest {
buildRule.executeTarget("testNoEmptySchemaLocation");
fail("Empty schema location");
} catch (BuildException ex) {
AntAssert.assertContains(SchemaValidate.SchemaLocation.ERROR_NO_LOCATION,
assertContains(SchemaValidate.SchemaLocation.ERROR_NO_LOCATION,
ex.getMessage());
}
}
@@ -88,7 +88,7 @@ public class SchemaValidateTest {
buildRule.executeTarget("testNoFile");
fail("No file at file attribute");
} catch (BuildException ex) {
AntAssert.assertContains(SchemaValidate.SchemaLocation.ERROR_NO_FILE,
assertContains(SchemaValidate.SchemaLocation.ERROR_NO_FILE,
ex.getMessage());
}
}
@@ -99,7 +99,7 @@ public class SchemaValidateTest {
buildRule.executeTarget("testNoDoubleSchemaLocation");
fail("Two locations for schemas");
} catch (BuildException ex) {
AntAssert.assertContains(SchemaValidate.SchemaLocation.ERROR_TWO_LOCATIONS,
assertContains(SchemaValidate.SchemaLocation.ERROR_TWO_LOCATIONS,
ex.getMessage());
}
}
@@ -110,7 +110,7 @@ public class SchemaValidateTest {
buildRule.executeTarget("testNoDuplicateSchema");
fail("duplicate schemas with different values");
} catch (BuildException ex) {
AntAssert.assertContains(SchemaValidate.ERROR_DUPLICATE_SCHEMA,
assertContains(SchemaValidate.ERROR_DUPLICATE_SCHEMA,
ex.getMessage());
}
}


+ 9
- 9
src/tests/junit/org/apache/tools/ant/taskdefs/optional/image/ImageTest.java View File

@@ -18,7 +18,6 @@

package org.apache.tools.ant.taskdefs.optional.image;

import org.apache.tools.ant.AntAssert;
import org.apache.tools.ant.BuildFileRule;
import org.apache.tools.ant.util.FileUtils;
import org.apache.tools.ant.util.JavaEnvUtils;
@@ -29,6 +28,7 @@ import org.junit.Test;

import java.io.File;

import static org.apache.tools.ant.AntAssert.assertContains;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeFalse;
@@ -60,13 +60,13 @@ public class ImageTest {
@Test
public void testEchoToLog() {
buildRule.executeTarget("testEchoToLog");
AntAssert.assertContains("Processing File", buildRule.getLog());
assertContains("Processing File", buildRule.getLog());
}

@Test
public void testSimpleScale() {
buildRule.executeTarget("testSimpleScale");
AntAssert.assertContains("Processing File", buildRule.getLog());
assertContains("Processing File", buildRule.getLog());

File f = new File(buildRule.getOutputDir(), LARGEIMAGE);
assertTrue("Did not create " + f.getAbsolutePath(), f.exists());
@@ -75,13 +75,13 @@ public class ImageTest {
@Test
public void testOverwriteTrue() {
buildRule.executeTarget("testSimpleScale");
AntAssert.assertContains("Processing File", buildRule.getLog());
assertContains("Processing File", buildRule.getLog());
File f = new File(buildRule.getOutputDir(), LARGEIMAGE);
assumeTrue("Could not change file modification date",
f.setLastModified(f.lastModified() - FILE_UTILS.getFileTimestampGranularity() * 2));
long lastModified = f.lastModified();
buildRule.executeTarget("testOverwriteTrue");
AntAssert.assertContains("Processing File", buildRule.getLog());
assertContains("Processing File", buildRule.getLog());
f = new File(buildRule.getOutputDir(), LARGEIMAGE);
long overwrittenLastModified = f.lastModified();
assertTrue("File was not overwritten.", lastModified < overwrittenLastModified);
@@ -90,11 +90,11 @@ public class ImageTest {
@Test
public void testOverwriteFalse() {
buildRule.executeTarget("testSimpleScale");
AntAssert.assertContains("Processing File", buildRule.getLog());
assertContains("Processing File", buildRule.getLog());
File f = new File(buildRule.getOutputDir(), LARGEIMAGE);
long lastModified = f.lastModified();
buildRule.executeTarget("testOverwriteFalse");
AntAssert.assertContains("Processing File", buildRule.getLog());
assertContains("Processing File", buildRule.getLog());
f = new File(buildRule.getOutputDir(), LARGEIMAGE);
long overwrittenLastModified = f.lastModified();
assertEquals("File was overwritten.", lastModified, overwrittenLastModified);
@@ -103,7 +103,7 @@ public class ImageTest {
@Test
public void testSimpleScaleWithMapper() {
buildRule.executeTarget("testSimpleScaleWithMapper");
AntAssert.assertContains("Processing File", buildRule.getLog());
assertContains("Processing File", buildRule.getLog());
File f = new File(buildRule.getOutputDir(), "scaled-" + LARGEIMAGE);
assertTrue("Did not create " + f.getAbsolutePath(), f.exists());
}
@@ -113,7 +113,7 @@ public class ImageTest {
public void testFailOnError() {
try {
buildRule.executeTarget("testFailOnError");
AntAssert.assertContains("Unable to process image stream", buildRule.getLog());
assertContains("Unable to process image stream", buildRule.getLog());
} catch (RuntimeException re) {
assertTrue("Run time exception should say 'Unable to process image stream'. :"
+ re.toString(),


+ 8
- 7
src/tests/junit/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTest.java View File

@@ -18,12 +18,13 @@

package org.apache.tools.ant.taskdefs.optional.jdepend;

import org.apache.tools.ant.AntAssert;
import org.apache.tools.ant.BuildFileRule;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;

import static org.apache.tools.ant.AntAssert.assertContains;

/**
* Testcase for the JDepend optional task.
*
@@ -45,7 +46,7 @@ public class JDependTest {
@Test
public void testSimple() {
buildRule.executeTarget("simple");
AntAssert.assertContains("Package: org.apache.tools.ant.util.facade",
assertContains("Package: org.apache.tools.ant.util.facade",
buildRule.getOutput());
}

@@ -55,7 +56,7 @@ public class JDependTest {
@Test
public void testXml() {
buildRule.executeTarget("xml");
AntAssert.assertContains("<DependsUpon>", buildRule.getOutput());
assertContains("<DependsUpon>", buildRule.getOutput());
}

/**
@@ -65,7 +66,7 @@ public class JDependTest {
@Test
public void testFork() {
buildRule.executeTarget("fork");
AntAssert.assertContains("Package: org.apache.tools.ant.util.facade", buildRule.getLog());
assertContains("Package: org.apache.tools.ant.util.facade", buildRule.getLog());
}

/**
@@ -74,7 +75,7 @@ public class JDependTest {
@Test
public void testForkXml() {
buildRule.executeTarget("fork-xml");
AntAssert.assertContains("<DependsUpon>", buildRule.getLog());
assertContains("<DependsUpon>", buildRule.getLog());
}

/**
@@ -83,7 +84,7 @@ public class JDependTest {
@Test
public void testTimeout() {
buildRule.executeTarget("fork-xml");
AntAssert.assertContains("JDepend FAILED - Timed out", buildRule.getLog());
assertContains("JDepend FAILED - Timed out", buildRule.getLog());
}


@@ -93,7 +94,7 @@ public class JDependTest {
@Test
public void testTimeoutNot() {
buildRule.executeTarget("fork-timeout-not");
AntAssert.assertContains("Package: org.apache.tools.ant.util.facade", buildRule.getLog());
assertContains("Package: org.apache.tools.ant.util.facade", buildRule.getLog());
}

}

+ 11
- 11
src/tests/junit/org/apache/tools/ant/types/AddTypeTest.java View File

@@ -18,7 +18,6 @@

package org.apache.tools.ant.types;

import org.apache.tools.ant.AntAssert;
import org.apache.tools.ant.BuildFileRule;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
@@ -28,6 +27,7 @@ import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;

import static org.apache.tools.ant.AntAssert.assertContains;
import static org.junit.Assert.fail;

public class AddTypeTest {
@@ -63,19 +63,19 @@ public class AddTypeTest {
@Test
public void testNestedA() {
buildRule.executeTarget("nested.a");
AntAssert.assertContains("add A called", buildRule.getLog());
assertContains("add A called", buildRule.getLog());
}

@Test
public void testNestedB() {
buildRule.executeTarget("nested.b");
AntAssert.assertContains("add B called", buildRule.getLog());
assertContains("add B called", buildRule.getLog());
}

@Test
public void testNestedC() {
buildRule.executeTarget("nested.c");
AntAssert.assertContains("add C called", buildRule.getLog());
assertContains("add C called", buildRule.getLog());
}

@Test
@@ -84,26 +84,26 @@ public class AddTypeTest {
buildRule.executeTarget("nested.ab");
fail("Build exception expected: Should have got ambiguous");
} catch (BuildException ex) {
AntAssert.assertContains("ambiguous", ex.getMessage());
assertContains("ambiguous", ex.getMessage());
}
}

@Test
public void testConditionType() {
buildRule.executeTarget("condition.type");
AntAssert.assertContains("beforeafter", buildRule.getLog());
assertContains("beforeafter", buildRule.getLog());
}

@Test
public void testConditionTask() {
buildRule.executeTarget("condition.task");
AntAssert.assertContains("My Condition execution", buildRule.getLog());
assertContains("My Condition execution", buildRule.getLog());
}

@Test
public void testConditionConditionType() {
buildRule.executeTarget("condition.condition.type");
AntAssert.assertContains("My Condition eval", buildRule.getLog());
assertContains("My Condition eval", buildRule.getLog());
}

@Test
@@ -112,21 +112,21 @@ public class AddTypeTest {
buildRule.executeTarget("condition.condition.task");
fail("Build exception expected: Task masking condition");
} catch (BuildException ex) {
AntAssert.assertContains("doesn't support the nested", ex.getMessage());
assertContains("doesn't support the nested", ex.getMessage());
}
}

@Test
public void testAddConfigured() {
buildRule.executeTarget("myaddconfigured");
AntAssert.assertContains("value is Value Setexecute: value is Value Set",
assertContains("value is Value Setexecute: value is Value Set",
buildRule.getLog());
}

@Test
public void testAddConfiguredValue() {
buildRule.executeTarget("myaddconfiguredvalue");
AntAssert.assertContains("value is Value Setexecute: value is Value Set",
assertContains("value is Value Setexecute: value is Value Set",
buildRule.getLog());
}



+ 6
- 5
src/tests/junit/org/apache/tools/ant/types/PolyTest.java View File

@@ -18,7 +18,6 @@

package org.apache.tools.ant.types;

import org.apache.tools.ant.AntAssert;
import org.apache.tools.ant.BuildFileRule;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
@@ -26,6 +25,8 @@ import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;

import static org.apache.tools.ant.AntAssert.assertContains;

public class PolyTest {

@Rule
@@ -39,25 +40,25 @@ public class PolyTest {
@Test
public void testFileSet() {
buildRule.executeTarget("fileset");
AntAssert.assertContains("types.FileSet", buildRule.getLog());
assertContains("types.FileSet", buildRule.getLog());
}

@Test
public void testFileSetAntType() {
buildRule.executeTarget("fileset-ant-type");
AntAssert.assertContains("types.PolyTest$MyFileSet", buildRule.getLog());
assertContains("types.PolyTest$MyFileSet", buildRule.getLog());
}

@Test
public void testPath() {
buildRule.executeTarget("path");
AntAssert.assertContains("types.Path", buildRule.getLog());
assertContains("types.Path", buildRule.getLog());
}

@Test
public void testPathAntType() {
buildRule.executeTarget("path-ant-type");
AntAssert.assertContains("types.PolyTest$MyPath", buildRule.getLog());
assertContains("types.PolyTest$MyPath", buildRule.getLog());
}

public static class MyFileSet extends FileSet {


+ 2
- 2
src/tests/junit/org/apache/tools/ant/types/RedirectorElementTest.java View File

@@ -17,7 +17,6 @@
*/
package org.apache.tools.ant.types;

import org.apache.tools.ant.AntAssert;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.BuildFileRule;
import org.apache.tools.ant.Project;
@@ -25,6 +24,7 @@ import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;

import static org.apache.tools.ant.AntAssert.assertContains;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

@@ -74,7 +74,7 @@ public class RedirectorElementTest {
public void testLogInputString() {
buildRule.executeTarget("testLogInputString");
if (buildRule.getLog().contains("testLogInputString can-cat")) {
AntAssert.assertContains("Using input string", buildRule.getFullLog());
assertContains("Using input string", buildRule.getFullLog());
}
}



+ 2
- 2
src/tests/junit/org/apache/tools/ant/types/selectors/ModifiedSelectorTest.java View File

@@ -24,7 +24,6 @@ import java.text.RuleBasedCollator;
import java.util.Comparator;
import java.util.Iterator;

import org.apache.tools.ant.AntAssert;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.BuildFileRule;
import org.apache.tools.ant.Project;
@@ -47,6 +46,7 @@ import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;

import static org.apache.tools.ant.AntAssert.assertContains;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
@@ -569,7 +569,7 @@ public class ModifiedSelectorTest {
public void testResourceSelectorSelresTrue() {
BFT bft = new BFT();
bft.doTarget("modifiedselectortest-ResourceSelresTrue");
AntAssert.assertContains("does not provide an InputStream", bft.getLog());
assertContains("does not provide an InputStream", bft.getLog());
bft.deleteCachefile();
}



Loading…
Cancel
Save