My favorites
▼
|
Sign in
swe-common-data-framework
OGC SWE Common Data Framework written in Java
Project Home
READ-ONLY: This project has been
archived
. For more information see
this post
.
Search
Search within:
All issues
Open issues
New issues
Issues to verify
for
Advanced search
Search tips
Subscriptions
Issue
1
attachment: Base64DecoderTest.java
(1.4 KB)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/**
*
*/
package org.vast.sweCommon;
import junit.framework.TestCase;
import java.io.ByteArrayInputStream;
/**
* @author Jesper Zedlitz <jze@informatik.uni-kiel.de>
*
*/
public class Base64DecoderTest extends TestCase {
public void testRead() throws Exception {
byte[] bytes = "SGVsbG8sIHdvcmxkIQ==".getBytes();
Base64Decoder decoder =
new Base64Decoder(new ByteArrayInputStream(bytes));
assertEquals('H', decoder.read());
assertEquals('e', decoder.read());
assertEquals('l', decoder.read());
assertEquals('l', decoder.read());
assertEquals('o', decoder.read());
assertEquals(',', decoder.read());
assertEquals(' ', decoder.read());
assertEquals('W', decoder.read());
assertEquals('o', decoder.read());
assertEquals('r', decoder.read());
assertEquals('l', decoder.read());
assertEquals('d', decoder.read());
assertEquals('!', decoder.read());
assertEquals(-1, decoder.read());
}
public void testReadArray() throws Exception {
byte[] bytes = "SGVsbG8sIHdvcmxkIQ==".getBytes();
Base64Decoder decoder =
new Base64Decoder(new ByteArrayInputStream(bytes));
byte[] output = new byte[16];
int len = decoder.read(output);
assertEquals(13, len);
assertEquals("Hello, world!", new String(output));
}
}
Powered by
Google Project Hosting