Stephan Richter
3 years ago
2 changed files with 48 additions and 6 deletions
@ -0,0 +1,44 @@
@@ -0,0 +1,44 @@
|
||||
package de.srsoftware.widerhall; |
||||
|
||||
import junit.framework.TestCase; |
||||
|
||||
import java.util.Map; |
||||
import java.util.TreeMap; |
||||
|
||||
public class UtilTest extends TestCase { |
||||
|
||||
public void testUrlEncode() { |
||||
TreeMap<String,Object> map = new TreeMap<>(); |
||||
map.put("a",1); |
||||
map.put("b",2); |
||||
map.put("c","&"); |
||||
map.put("d","="); |
||||
assertEquals("a=1&b=2&c=%26&d=%3D",Util.urlEncode(map)); |
||||
} |
||||
|
||||
public void testHex(){ |
||||
assertEquals("00",Util.hex(0)); |
||||
assertEquals("09",Util.hex(9)); |
||||
assertEquals("0A",Util.hex(10)); |
||||
assertEquals("0F",Util.hex(15)); |
||||
assertEquals("10",Util.hex(16)); |
||||
assertEquals("19",Util.hex(25)); |
||||
assertEquals("FF",Util.hex(255)); |
||||
} |
||||
|
||||
public void testSha256() { |
||||
assertEquals("9F722959A023C02A3BA0FAFDBA81ADED642D6610EFF5DCA32DCE35132E16B6C5",Util.sha256("Dies ist ein Test")); |
||||
} |
||||
|
||||
public void testTranslate() { |
||||
assertEquals("Dies ist ein Test",Util.t("{} {} {} {}","Dies","ist","ein","Test")); |
||||
} |
||||
|
||||
public void testIsEmail() { |
||||
// TODO
|
||||
} |
||||
|
||||
public void testSimplePassword() { |
||||
// TODO
|
||||
} |
||||
} |
Loading…
Reference in new issue