You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by br...@apache.org on 2013/11/22 17:06:35 UTC

svn commit: r1544594 - in /subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl: BasicTests.java SVNTests.java WC.java

Author: brane
Date: Fri Nov 22 16:06:35 2013
New Revision: 1544594

URL: http://svn.apache.org/r1544594
Log:
Clean up the remaining warnings in JavaHL tests.

[in subversion/bindings/javahl]
* tests/org/apache/subversion/javahl/SVNTests.java
  (SVNTests.getStatusArray): Remove useless cast.
* tests/org/apache/subversion/javahl/BasicTests.java
  (BasicTests.testMergeReintegrate): Suppress deprecation warnings from this
   test case, since it exercises a deprecated method.
  (BasicTests.acquireMergeinfoAndAssertEquals,
   BasicTests.assertExpectedDiffSummaries): Remove useless casts.

* tests/org/apache/subversion/javahl/WC.java:
   Do not import (deprecated) class junit.framework.Assert.
  (WC): Inherit from TestCase instead, and update all
   assertions to use the inherited methods.

Modified:
    subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java
    subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNTests.java
    subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/WC.java

Modified: subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java?rev=1544594&r1=1544593&r2=1544594&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java (original)
+++ subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java Fri Nov 22 16:06:35 2013
@@ -2350,7 +2350,7 @@ public class BasicTests extends SVNTests
         List<RevisionRange> ranges = mergeInfo.getRevisions(mergeSrc);
         assertTrue("Missing merge info for source '" + mergeSrc + "' on '" +
                    targetPath + '\'', ranges != null && !ranges.isEmpty());
-        RevisionRange range = (RevisionRange) ranges.get(0);
+        RevisionRange range = ranges.get(0);
         String expectedMergedRevs = expectedMergeStart + "-" + expectedMergeEnd;
         assertEquals("Unexpected first merged revision range for '" +
                      mergeSrc + "' on '" + targetPath + '\'',
@@ -2613,6 +2613,7 @@ public class BasicTests extends SVNTests
      * @throws Throwable
      * @since 1.5
      */
+    @SuppressWarnings("deprecation")
     public void testMergeReintegrate() throws Throwable
     {
         OneTest thisTest = setupAndPerformMerge();
@@ -3269,7 +3270,7 @@ public class BasicTests extends SVNTests
 
         // Rigorously inspect one of our DiffSummary notifications.
         final String BETA_PATH = "A/B/E/beta";
-        DiffSummary betaDiff = (DiffSummary) summaries.get(BETA_PATH);
+        DiffSummary betaDiff = summaries.get(BETA_PATH);
         assertNotNull("No diff summary for " + BETA_PATH, betaDiff);
         assertEquals("Incorrect path for " + BETA_PATH, BETA_PATH,
                      betaDiff.getPath());

Modified: subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNTests.java
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNTests.java?rev=1544594&r1=1544593&r2=1544594&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNTests.java (original)
+++ subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNTests.java Fri Nov 22 16:06:35 2013
@@ -927,7 +927,7 @@ class SVNTests extends TestCase
 
         public Status[] getStatusArray()
         {
-            return (Status[]) statuses.toArray(new Status[statuses.size()]);
+            return statuses.toArray(new Status[statuses.size()]);
         }
     }
 }

Modified: subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/WC.java
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/WC.java?rev=1544594&r1=1544593&r2=1544594&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/WC.java (original)
+++ subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/WC.java Fri Nov 22 16:06:35 2013
@@ -34,11 +34,12 @@ import java.util.Date;
 
 import org.apache.subversion.javahl.types.*;
 
-import junit.framework.Assert;
+import junit.framework.TestCase;
+
 /**
  * This class describe the expected state of the working copy
  */
-public class WC
+public class WC extends TestCase
 {
     /**
      * the map of the items of the working copy. The relative path is the key
@@ -169,9 +170,9 @@ public class WC
         // since having no content signals a directory, changes of removing the
         // content or setting a former not set content is not allowed. That
         // would change the type of the item.
-        Assert.assertNotNull("cannot unset content", content);
+        assertNotNull("cannot unset content", content);
         Item i = items.get(path);
-        Assert.assertNotNull("cannot set content on directory", i.myContent);
+        assertNotNull("cannot set content on directory", i.myContent);
         i.myContent = content;
     }
 
@@ -304,13 +305,13 @@ public class WC
      */
     void check(DirEntry[] tested, String singleFilePath)
     {
-        Assert.assertEquals("not a single dir entry", 1, tested.length);
+        assertEquals("not a single dir entry", 1, tested.length);
         Item item = items.get(singleFilePath);
-        Assert.assertNotNull("not found in working copy", item);
-        Assert.assertNotNull("not a file", item.myContent);
-        Assert.assertEquals("state says file, working copy not",
-                tested[0].getNodeKind(),
-                item.nodeKind == null ? NodeKind.file : item.nodeKind);
+        assertNotNull("not found in working copy", item);
+        assertNotNull("not a file", item.myContent);
+        assertEquals("state says file, working copy not",
+                     tested[0].getNodeKind(),
+                     item.nodeKind == null ? NodeKind.file : item.nodeKind);
     }
 
     /**
@@ -342,19 +343,18 @@ public class WC
         {
             String name = basePath + entry.getPath();
             Item item = items.get(name);
-            Assert.assertNotNull("null paths won't be found in working copy",
-                                 item);
+            assertNotNull("null paths won't be found in working copy", item);
             if (item.myContent != null)
             {
-                Assert.assertEquals("Expected '" + entry + "' to be file",
-                        entry.getNodeKind(),
-                        item.nodeKind == null ? NodeKind.file : item.nodeKind);
+                assertEquals("Expected '" + entry + "' to be file",
+                             entry.getNodeKind(),
+                             item.nodeKind == null ? NodeKind.file : item.nodeKind);
             }
             else
             {
-                Assert.assertEquals("Expected '" + entry + "' to be dir",
-                        entry.getNodeKind(),
-                        item.nodeKind == null ? NodeKind.dir : item.nodeKind);
+                assertEquals("Expected '" + entry + "' to be dir",
+                             entry.getNodeKind(),
+                             item.nodeKind == null ? NodeKind.dir : item.nodeKind);
             }
             item.touched = true;
         }
@@ -369,9 +369,9 @@ public class WC
                         !item.myPath.equals(basePath))
                 {
                     // Non-recursive checks will fail here.
-                    Assert.assertFalse("Expected path '" + item.myPath +
-                                       "' not found in dir entries",
-                                       recursive);
+                    assertFalse("Expected path '" + item.myPath +
+                                "' not found in dir entries",
+                                recursive);
 
                     // Look deeper under the tree.
                     boolean found = false;
@@ -387,8 +387,8 @@ public class WC
                             }
                         }
                     }
-                    Assert.assertTrue("Expected path '" + item.myPath +
-                                       "' not found in dir entries", found);
+                    assertTrue("Expected path '" + item.myPath +
+                               "' not found in dir entries", found);
                 }
             }
         }
@@ -436,14 +436,14 @@ public class WC
         for (Status status : tested)
         {
             String path = status.getPath();
-            Assert.assertTrue("status path starts not with working copy path",
-                    path.startsWith(normalizeWCPath));
+            assertTrue("status path starts not with working copy path",
+                       path.startsWith(normalizeWCPath));
 
             // we calculate the relative path to the working copy root
             if (path.length() > workingCopyPath.length() + 1)
             {
-                Assert.assertEquals("missing '/' in status path",
-                        path.charAt(workingCopyPath.length()), '/');
+                assertEquals("missing '/' in status path",
+                             path.charAt(workingCopyPath.length()), '/');
                 path = path.substring(workingCopyPath.length() + 1);
             }
             else
@@ -451,25 +451,23 @@ public class WC
                 path = "";
 
             Item item = items.get(path);
-            Assert.assertNotNull("status not found in working copy: " + path,
-                    item);
-            Assert.assertEquals("wrong text status in working copy: " + path,
-                    item.textStatus, status.getTextStatus());
+            assertNotNull("status not found in working copy: " + path, item);
+            assertEquals("wrong text status in working copy: " + path,
+                         item.textStatus, status.getTextStatus());
             if (item.workingCopyRev != -1)
-                Assert.assertEquals("wrong revision number in working copy: "
-                            + path,
-                        item.workingCopyRev, status.getRevisionNumber());
-            Assert.assertEquals("lock status wrong: " + path,
-                    item.isLocked, status.isLocked());
-            Assert.assertEquals("switch status wrong: " + path,
-                    item.isSwitched, status.isSwitched());
-            Assert.assertEquals("wrong prop status in working copy: " + path,
-                    item.propStatus, status.getPropStatus());
+                assertEquals("wrong revision number in working copy: " + path,
+                             item.workingCopyRev, status.getRevisionNumber());
+            assertEquals("lock status wrong: " + path,
+                         item.isLocked, status.isLocked());
+            assertEquals("switch status wrong: " + path,
+                         item.isSwitched, status.isSwitched());
+            assertEquals("wrong prop status in working copy: " + path,
+                         item.propStatus, status.getPropStatus());
             if (item.myContent != null)
             {
-                Assert.assertEquals("state says file, working copy not: " + path,
-                        status.getNodeKind(),
-                        item.nodeKind == null ? NodeKind.file : item.nodeKind);
+                assertEquals("state says file, working copy not: " + path,
+                             status.getNodeKind(),
+                             item.nodeKind == null ? NodeKind.file : item.nodeKind);
                 if (status.getTextStatus() == Status.Kind.normal ||
                         item.checkContent)
                 {
@@ -483,26 +481,26 @@ public class WC
                         buffer.append((char) ch);
                     }
                     rd.close();
-                    Assert.assertEquals("content mismatch: " + path,
-                            buffer.toString(), item.myContent);
+                    assertEquals("content mismatch: " + path,
+                                 buffer.toString(), item.myContent);
                 }
             }
             else
             {
-                Assert.assertEquals("state says dir, working copy not: " + path,
-                        status.getNodeKind(),
-                        item.nodeKind == null ? NodeKind.dir : item.nodeKind);
+                assertEquals("state says dir, working copy not: " + path,
+                             status.getNodeKind(),
+                             item.nodeKind == null ? NodeKind.dir : item.nodeKind);
             }
 
             if (checkRepos)
             {
-                Assert.assertEquals("Last commit revisions for OOD path '"
-                                    + item.myPath + "' don't match:",
-                                    item.reposLastCmtRevision,
-                                    status.getReposLastCmtRevisionNumber());
-                Assert.assertEquals("Last commit kinds for OOD path '"
-                                    + item.myPath + "' don't match:",
-                                    item.reposKind, status.getReposKind());
+                assertEquals("Last commit revisions for OOD path '"
+                             + item.myPath + "' don't match:",
+                             item.reposLastCmtRevision,
+                             status.getReposLastCmtRevisionNumber());
+                assertEquals("Last commit kinds for OOD path '"
+                             + item.myPath + "' don't match:",
+                             item.reposKind, status.getReposKind());
 
                 // Only the last committed rev and kind is available for
                 // paths deleted in the repos.
@@ -511,17 +509,17 @@ public class WC
                     long lastCmtTime =
                         (status.getReposLastCmtDate() == null ?
                          0 : status.getReposLastCmtDate().getTime());
-                    Assert.assertEquals("Last commit dates for OOD path '" +
-                                        item.myPath + "' don't match:",
-                                        new Date(item.reposLastCmtDate),
-                                        new Date(lastCmtTime));
-                    Assert.assertEquals("Last commit authors for OOD path '"
-                                        + item.myPath + "' don't match:",
-                                        item.reposLastCmtAuthor,
-                                        status.getReposLastCmtAuthor());
-                    Assert.assertNotNull("URL for path " + item.myPath
-                                         + " should not be null",
-                                         status.getUrl());
+                    assertEquals("Last commit dates for OOD path '" +
+                                 item.myPath + "' don't match:",
+                                 new Date(item.reposLastCmtDate),
+                                 new Date(lastCmtTime));
+                    assertEquals("Last commit authors for OOD path '"
+                                 + item.myPath + "' don't match:",
+                                 item.reposLastCmtAuthor,
+                                 status.getReposLastCmtAuthor());
+                    assertNotNull("URL for path " + item.myPath
+                                  + " should not be null",
+                                  status.getUrl());
                 }
             }
             item.touched = true;
@@ -531,9 +529,9 @@ public class WC
         // result array
         for (Item item : items.values())
         {
-            Assert.assertTrue("item '" + item.myPath +
-                              "' in working copy not found in status",
-                    item.touched);
+            assertTrue("item '" + item.myPath +
+                       "' in working copy not found in status",
+                       item.touched);
         }
     }