diff options
author | David Pursehouse <david.pursehouse@gmail.com> | 2019-06-02 17:02:51 +0900 |
---|---|---|
committer | David Pursehouse <david.pursehouse@gmail.com> | 2019-06-03 08:07:24 +0900 |
commit | ee747827b0d26cf770f44a33b201de31e81ca8ea (patch) | |
tree | 0ae0555ffb44f5c9adcb0b94a675ed3e90ac441e /org.eclipse.jgit.http.test/tst | |
parent | e0133b9440cf28cc8495e4af0546d1467edbb028 (diff) | |
download | jgit-ee747827b0d26cf770f44a33b201de31e81ca8ea.tar.gz jgit-ee747827b0d26cf770f44a33b201de31e81ca8ea.zip |
PacketLineIn: Add an iterator over strings in the input stream
Allows callers to read all lines in the input stream until the
END marker is reached, without having to explicitly check for
the END marker.
Replace all remaining usage of the END marker with the new method.
Change-Id: I51f419c7f569ab7ed01e1aaaf6b40ed8cdc2116b
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Diffstat (limited to 'org.eclipse.jgit.http.test/tst')
-rw-r--r-- | org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HttpClientTests.java | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HttpClientTests.java b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HttpClientTests.java index 4158049171..8ec2f51cff 100644 --- a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HttpClientTests.java +++ b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HttpClientTests.java @@ -387,8 +387,7 @@ public class HttpClientTests extends HttpTestCase { // What remains are capabilities - ensure that all of them are // non-empty strings, and that we see END at the end. - String s; - while ((s = pckIn.readString()) != PacketLineIn.END) { + for (String s : pckIn.readStrings()) { assertTrue(!s.isEmpty()); } } @@ -421,8 +420,7 @@ public class HttpClientTests extends HttpTestCase { PacketLineIn pckIn = new PacketLineIn(c.getInputStream()); // Just check that we get what looks like a ref advertisement. - String s; - while ((s = pckIn.readString()) != PacketLineIn.END) { + for (String s : pckIn.readStrings()) { assertTrue(s.matches("[0-9a-f]{40} [A-Za-z/]*")); } |