Browse Source

Avoid JUNIT methods requiring java 1.4 or higher.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@473781 13f79535-47bb-0310-9956-ffa450edef68
master
Jacobus Martinus Kruithof 18 years ago
parent
commit
5f2768c82e
4 changed files with 9 additions and 8 deletions
  1. +2
    -1
      src/tests/junit/org/apache/tools/ant/IntrospectionHelperTest.java
  2. +3
    -3
      src/tests/junit/org/apache/tools/ant/taskdefs/ManifestTest.java
  3. +3
    -3
      src/tests/junit/org/apache/tools/ant/taskdefs/PropertyTest.java
  4. +1
    -1
      src/tests/junit/org/apache/tools/tar/TarRoundTripTest.java

+ 2
- 1
src/tests/junit/org/apache/tools/ant/IntrospectionHelperTest.java View File

@@ -589,7 +589,8 @@ public class IntrospectionHelperTest extends TestCase {
} }


public void setNineteen(double d) { public void setNineteen(double d) {
assertEquals(19, d, 1e-6);
double diff = d - 19;
assertTrue("Expected 19, received " + d, diff > -1e-6 && diff < 1e-6);
} }


public void testGetExtensionPoints() { public void testGetExtensionPoints() {


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

@@ -108,7 +108,7 @@ public class ManifestTest extends BuildFileTest {
executeTarget("test5"); executeTarget("test5");
String output = getLog(); String output = getLog();
boolean hasWarning = output.indexOf("Manifest warning: \"Name\" attributes should not occur in the main section") != -1; boolean hasWarning = output.indexOf("Manifest warning: \"Name\" attributes should not occur in the main section") != -1;
assertEquals("Expected warning about Name in main section", true, hasWarning);
assertTrue("Expected warning about Name in main section", hasWarning);
} }


/** /**
@@ -119,7 +119,7 @@ public class ManifestTest extends BuildFileTest {
"Invalid Manifest"); "Invalid Manifest");
String output = getLog(); String output = getLog();
boolean hasWarning = output.indexOf("Manifest sections should start with a \"Name\" attribute") != -1; boolean hasWarning = output.indexOf("Manifest sections should start with a \"Name\" attribute") != -1;
assertEquals("Expected warning about section not starting with Name: attribute", true, hasWarning);
assertTrue("Expected warning about section not starting with Name: attribute", hasWarning);
} }


/** /**
@@ -129,7 +129,7 @@ public class ManifestTest extends BuildFileTest {
executeTarget("test7"); executeTarget("test7");


boolean hasWarning = getLog().indexOf(Manifest.ERROR_FROM_FORBIDDEN) != -1; boolean hasWarning = getLog().indexOf(Manifest.ERROR_FROM_FORBIDDEN) != -1;
assertEquals("Expected warning about From: attribute", true, hasWarning);
assertTrue("Expected warning about From: attribute", hasWarning);
} }


/** /**


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

@@ -51,7 +51,7 @@ public class PropertyTest extends BuildFileTest {
executeTarget("test3"); executeTarget("test3");
} }
catch (BuildException e) { catch (BuildException e) {
assertEquals("Circular definition not detected - ", true,
assertTrue("Circular definition not detected - ",
e.getMessage().indexOf("was circularly defined") != -1); e.getMessage().indexOf("was circularly defined") != -1);
return; return;
} }
@@ -85,7 +85,7 @@ public class PropertyTest extends BuildFileTest {
executeTarget("prefix.fail"); executeTarget("prefix.fail");
} }
catch (BuildException e) { catch (BuildException e) {
assertEquals("Prefix allowed on non-resource/file load - ", true,
assertTrue("Prefix allowed on non-resource/file load - ",
e.getMessage().indexOf("Prefix is only valid") != -1); e.getMessage().indexOf("Prefix is only valid") != -1);
return; return;
} }
@@ -96,7 +96,7 @@ public class PropertyTest extends BuildFileTest {
try { try {
executeTarget("testCircularReference"); executeTarget("testCircularReference");
} catch (BuildException e) { } catch (BuildException e) {
assertEquals("Circular definition not detected - ", true,
assertTrue("Circular definition not detected - ",
e.getMessage().indexOf("was circularly defined") e.getMessage().indexOf("was circularly defined")
!= -1); != -1);
return; return;


+ 1
- 1
src/tests/junit/org/apache/tools/tar/TarRoundTripTest.java View File

@@ -37,7 +37,7 @@ public class TarRoundTripTest extends TestCase {
*/ */
public void testLongRoundTripping() throws IOException { public void testLongRoundTripping() throws IOException {
TarEntry original = new TarEntry(LONG_NAME); TarEntry original = new TarEntry(LONG_NAME);
assertEquals("over 100 chars", true, LONG_NAME.length() > 100);
assertTrue("over 100 chars", LONG_NAME.length() > 100);
assertEquals("original name", LONG_NAME, original.getName()); assertEquals("original name", LONG_NAME, original.getName());






Loading…
Cancel
Save