extended TrytesConverter test

This commit is contained in:
pinpong 2016-12-31 10:49:30 +01:00
parent 368d613266
commit b422b40243

View File

@ -1,12 +1,12 @@
package jota;
import jota.utils.TrytesConverter;
import org.apache.commons.lang3.RandomStringUtils;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.apache.commons.lang3.RandomStringUtils;
/**
* Created by pinpong on 01.12.16.
*/
@ -15,19 +15,21 @@ public class TrytesConverterTest {
@Test
public void shouldConvertStringToTrytes() {
assertEquals(TrytesConverter.toTrytes("Z"), "IC");
assertEquals(TrytesConverter.toTrytes("JOTA JOTA"), "TBYBCCKBEATBYBCCKB");
}
@Test
public void shouldConvertTrytesToString() {
assertEquals(TrytesConverter.toString("IC"), "Z");
assertEquals(TrytesConverter.toString("TBYBCCKBEATBYBCCKB"), "JOTA JOTA");
}
@Test
public void shouldConvertBackAndForth() {
String str = RandomStringUtils.randomAlphabetic(1000).toUpperCase();
System.err.println(str);
String back = TrytesConverter.toString(TrytesConverter.toTrytes(str));
assertTrue(str.equals(back));
}
}
}