Skip to content

Commit

Permalink
fix test cases for CertificateRequest
Browse files Browse the repository at this point in the history
  • Loading branch information
JacksonTian committed Jun 8, 2023
1 parent f678fcf commit 677124a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public CertificateRequest(short[] types, Vector<byte[]> certificateAuthorities)
public byte[] getBytes() throws IOException {
ByteArrayOutputStream ba = new ByteArrayOutputStream();
// write type length
int length = this.certificateAuthorities.size();
int length = this.certificateTypes.length;
ba.write(length);
// write types
for (int i = 0; i < length; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
public class CertificateRequestTest {

@Test
public void nullTest() throws Exception{
public void getBytesTest() throws Exception{
short[] types = new short[] {1, 2, 3};
Vector<byte[]> v = new Vector<>();
Assert.assertNull(new CertificateRequest(types, v).getBytes());
byte[] expected = new byte[] {0x03, 0x01, 0x02, 0x03, 0x00, 0x00};
Assert.assertArrayEquals(expected, new CertificateRequest(types, v).getBytes());
}
}

0 comments on commit 677124a

Please sign in to comment.