diff options
author | Dave Borowitz <dborowitz@google.com> | 2015-07-15 18:04:10 -0700 |
---|---|---|
committer | Dave Borowitz <dborowitz@google.com> | 2015-07-15 18:09:42 -0700 |
commit | 74a57f37441eb5faa1ad335b095fcb43bc924c1a (patch) | |
tree | d41ceeea187730e5844adba3960bf5fd92e74a36 /org.eclipse.jgit.test | |
parent | c7c5fe718d6b1dee3f8537a97bc38b57542e9e53 (diff) | |
download | jgit-74a57f37441eb5faa1ad335b095fcb43bc924c1a.tar.gz jgit-74a57f37441eb5faa1ad335b095fcb43bc924c1a.zip |
PushCertificateParser: Add fromString method
Change-Id: I74c3f65a9ff297f708d996a4c138456a31a466b8
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushCertificateParserTest.java | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushCertificateParserTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushCertificateParserTest.java index 3a4b00d876..824766e165 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushCertificateParserTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushCertificateParserTest.java @@ -55,6 +55,7 @@ import java.io.EOFException; import java.io.IOException; import java.io.InputStreamReader; import java.io.Reader; +import java.io.StringReader; import org.eclipse.jgit.errors.PackProtocolException; import org.eclipse.jgit.internal.storage.dfs.DfsRepositoryDescription; @@ -280,9 +281,7 @@ public class PushCertificateParserTest { @Test public void testParseReader() throws Exception { - Reader reader = new InputStreamReader( - new ByteArrayInputStream( - Constants.encode(concatPacketLines(INPUT, 0, 18)))); + Reader reader = new StringReader(concatPacketLines(INPUT, 0, 18)); PushCertificate streamCert = PushCertificateParser.fromReader(reader); PacketLineIn pckIn = newPacketLineIn(INPUT); @@ -321,6 +320,14 @@ public class PushCertificateParserTest { } @Test + public void testParseString() throws Exception { + String str = concatPacketLines(INPUT, 0, 18); + assertEquals( + PushCertificateParser.fromReader(new StringReader(str)), + PushCertificateParser.fromString(str)); + } + + @Test public void testParseMultipleFromStream() throws Exception { String input = concatPacketLines(INPUT, 0, 17); assertFalse(input.contains(PushCertificateParser.END_CERT)); |