summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
diff options
context:
space:
mode:
authorCarsten Hammer <carsten.hammer@t-online.de>2019-04-06 19:16:36 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2019-04-13 19:33:13 +0200
commit6e03645ad80adf71527ca18f937db4b8e34b7f13 (patch)
tree180b2049810f45b80af4268da6918cb5a94501b7 /org.eclipse.jgit.test
parentc0268f899e3e600a45f6c028f4d0088b2fb2fce1 (diff)
downloadjgit-6e03645ad80adf71527ca18f937db4b8e34b7f13.tar.gz
jgit-6e03645ad80adf71527ca18f937db4b8e34b7f13.zip
Use jdk 5 for loop
Replace simple uses of Iterator with a corresponding for-loop. Also add missing braces on loops as necessary. Change-Id: I708d82acdf194787e3353699c07244c5ac3de189 Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheBasicTest.java10
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheBuilderIteratorTest.java5
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheBuilderTest.java10
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheFindTest.java5
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheIteratorTest.java40
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheTreeTest.java15
6 files changed, 51 insertions, 34 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheBasicTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheBasicTest.java
index 014406eb98..972dc60156 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheBasicTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheBasicTest.java
@@ -205,8 +205,9 @@ public class DirCacheBasicTest extends RepositoryTestCase {
}
final DirCacheBuilder b = dc.builder();
- for (int i = 0; i < ents.length; i++)
- b.add(ents[i]);
+ for (DirCacheEntry ent : ents) {
+ b.add(ent);
+ }
b.finish();
assertFalse(dc.hasUnmergedPaths());
@@ -229,8 +230,9 @@ public class DirCacheBasicTest extends RepositoryTestCase {
ents[2].setFileMode(FileMode.REGULAR_FILE);
final DirCacheBuilder b = dc.builder();
- for (int i = 0; i < ents.length; i++)
- b.add(ents[i]);
+ for (DirCacheEntry ent : ents) {
+ b.add(ent);
+ }
b.finish();
assertTrue(dc.hasUnmergedPaths());
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheBuilderIteratorTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheBuilderIteratorTest.java
index 3598f3a4a1..6020a748aa 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheBuilderIteratorTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheBuilderIteratorTest.java
@@ -71,8 +71,9 @@ public class DirCacheBuilderIteratorTest extends RepositoryTestCase {
}
{
final DirCacheBuilder b = dc.builder();
- for (int i = 0; i < ents.length; i++)
- b.add(ents[i]);
+ for (DirCacheEntry ent : ents) {
+ b.add(ent);
+ }
b.finish();
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheBuilderTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheBuilderTest.java
index b6291bfca4..b284771e58 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheBuilderTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheBuilderTest.java
@@ -301,8 +301,9 @@ public class DirCacheBuilderTest extends RepositoryTestCase {
}
final DirCacheBuilder b = dc.builder();
- for (int i = 0; i < ents.length; i++)
- b.add(ents[i]);
+ for (DirCacheEntry ent : ents) {
+ b.add(ent);
+ }
b.finish();
assertEquals(paths.length, dc.getEntryCount());
@@ -351,8 +352,9 @@ public class DirCacheBuilderTest extends RepositoryTestCase {
}
{
final DirCacheBuilder b = dc.builder();
- for (int i = 0; i < ents.length; i++)
- b.add(ents[i]);
+ for (DirCacheEntry ent : ents) {
+ b.add(ent);
+ }
b.finish();
}
assertEquals(paths.length, dc.getEntryCount());
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheFindTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheFindTest.java
index 3b8c6ee7b4..7fc28018f6 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheFindTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheFindTest.java
@@ -66,8 +66,9 @@ public class DirCacheFindTest extends RepositoryTestCase {
final int aLast = 3;
final DirCacheBuilder b = dc.builder();
- for (int i = 0; i < ents.length; i++)
- b.add(ents[i]);
+ for (DirCacheEntry ent : ents) {
+ b.add(ent);
+ }
b.finish();
assertEquals(paths.length, dc.getEntryCount());
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheIteratorTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheIteratorTest.java
index 82565fceec..bc99aeef2f 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheIteratorTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheIteratorTest.java
@@ -94,8 +94,9 @@ public class DirCacheIteratorTest extends RepositoryTestCase {
}
final DirCacheBuilder b = dc.builder();
- for (int i = 0; i < ents.length; i++)
- b.add(ents[i]);
+ for (DirCacheEntry ent : ents) {
+ b.add(ent);
+ }
b.finish();
final DirCacheIterator i = new DirCacheIterator(dc);
@@ -121,8 +122,9 @@ public class DirCacheIteratorTest extends RepositoryTestCase {
}
final DirCacheBuilder b = dc.builder();
- for (int i = 0; i < ents.length; i++)
- b.add(ents[i]);
+ for (DirCacheEntry ent : ents) {
+ b.add(ent);
+ }
b.finish();
final DirCacheIterator i = new DirCacheIterator(dc);
@@ -154,8 +156,9 @@ public class DirCacheIteratorTest extends RepositoryTestCase {
}
final DirCacheBuilder b = dc.builder();
- for (int i = 0; i < ents.length; i++)
- b.add(ents[i]);
+ for (DirCacheEntry ent : ents) {
+ b.add(ent);
+ }
b.finish();
final String[] expPaths = { "a-", "a", "a0b" };
@@ -200,8 +203,9 @@ public class DirCacheIteratorTest extends RepositoryTestCase {
}
final DirCacheBuilder b = dc.builder();
- for (int i = 0; i < ents.length; i++)
- b.add(ents[i]);
+ for (DirCacheEntry ent : ents) {
+ b.add(ent);
+ }
b.finish();
final DirCacheIterator i = new DirCacheIterator(dc);
@@ -236,8 +240,9 @@ public class DirCacheIteratorTest extends RepositoryTestCase {
}
final DirCacheBuilder b = dc.builder();
- for (int i = 0; i < ents.length; i++)
- b.add(ents[i]);
+ for (DirCacheEntry ent : ents) {
+ b.add(ent);
+ }
b.finish();
try (TreeWalk tw = new TreeWalk(db)) {
@@ -271,8 +276,9 @@ public class DirCacheIteratorTest extends RepositoryTestCase {
}
final DirCacheBuilder b = dc.builder();
- for (int i = 0; i < ents.length; i++)
- b.add(ents[i]);
+ for (DirCacheEntry ent : ents) {
+ b.add(ent);
+ }
b.finish();
DirCacheIterator dci = new DirCacheIterator(dc);
@@ -365,8 +371,9 @@ public class DirCacheIteratorTest extends RepositoryTestCase {
}
final DirCacheBuilder b = dc.builder();
- for (int i = 0; i < ents.length; i++)
- b.add(ents[i]);
+ for (DirCacheEntry ent : ents) {
+ b.add(ent);
+ }
b.finish();
DirCacheIterator dci = new DirCacheIterator(dc);
@@ -398,8 +405,9 @@ public class DirCacheIteratorTest extends RepositoryTestCase {
}
final DirCacheBuilder b = dc.builder();
- for (int i = 0; i < ents.length; i++)
- b.add(ents[i]);
+ for (DirCacheEntry ent : ents) {
+ b.add(ent);
+ }
b.finish();
try (TreeWalk tw = new TreeWalk(db)) {
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheTreeTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheTreeTest.java
index f662e2660c..513db75323 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheTreeTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheTreeTest.java
@@ -102,8 +102,9 @@ public class DirCacheTreeTest extends RepositoryTestCase {
final int aLast = 3;
final DirCacheBuilder b = dc.builder();
- for (int i = 0; i < ents.length; i++)
- b.add(ents[i]);
+ for (DirCacheEntry ent : ents) {
+ b.add(ent);
+ }
b.finish();
assertNull(dc.getCacheTree(false));
@@ -142,8 +143,9 @@ public class DirCacheTreeTest extends RepositoryTestCase {
final int acLast = 3;
final DirCacheBuilder b = dc.builder();
- for (int i = 0; i < ents.length; i++)
- b.add(ents[i]);
+ for (DirCacheEntry ent : ents) {
+ b.add(ent);
+ }
b.finish();
assertNull(dc.getCacheTree(false));
@@ -198,8 +200,9 @@ public class DirCacheTreeTest extends RepositoryTestCase {
}
final DirCacheBuilder b = dc.builder();
- for (int i = 0; i < ents.length; i++)
- b.add(ents[i]);
+ for (DirCacheEntry ent : ents) {
+ b.add(ent);
+ }
b.commit();
DirCache read = db.readDirCache();