Debian Codegraph @

minidns-core/src/test/java/org/minidns/util/Base64Test.java

raw
1 /*
2 * Copyright 2015-2020 the original author or authors
3 *
4 * This software is licensed under the Apache License, Version 2.0,
5 * the GNU Lesser General Public License version 2 or later ("LGPL")
6 * and the WTFPL.
7 * You may choose either license to govern your use of this software only
8 * upon the condition that you accept all of the terms of either
9 * the Apache License 2.0, the LGPL 2.1+ or the WTFPL.
10 */
11 package org.minidns.util;
12
13 import org.junit.jupiter.api.Test;
14
15 import static org.junit.jupiter.api.Assertions.assertEquals;
16
17 public class Base64Test {
18 @Test
19 public void testEncodeToString() {
20 assertEquals("", Base64.encodeToString(new byte[] {}));
21 assertEquals("Qg==", Base64.encodeToString(new byte[] {0x42}));
22 assertEquals("AQID", Base64.encodeToString(new byte[] {1, 2, 3}));
23 assertEquals("CAIGAP8B/wA=", Base64.encodeToString(new byte[] {8, 2, 6, 0, -1, 1, -1, 0}));
24 }
25 }