Added toString interface
This commit is contained in:
parent
107435ec13
commit
be3f1a9476
7 changed files with 83 additions and 13 deletions
|
|
@ -0,0 +1,39 @@
|
|||
package love.distributedrebirth.bassboon.jpp.lang;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import love.distributedrebirth.bassboon.clazz.BãßBȍőnAuthor注;
|
||||
|
||||
@BãßBȍőnAuthor注(name = "للَّٰهِilLצسُو", copyright = "©Δ∞ 仙上主天")
|
||||
public class ObjectToHumanTest {
|
||||
|
||||
@Test
|
||||
public void testObjectToHuman() {
|
||||
class HumanObjectSimple implements ObjectToHuman {
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ik probeer mens te zijn...";
|
||||
}
|
||||
}
|
||||
HumanObjectSimple object = new HumanObjectSimple();
|
||||
Assertions.assertTrue(object != null);
|
||||
Assertions.assertTrue(object.toString() != null);
|
||||
Assertions.assertTrue(object.toStringUnicode() != null);
|
||||
Assertions.assertEquals(object.toString().length(), object.toStringUnicode().lengthChars());
|
||||
Assertions.assertTrue(object.toString().contains("mens"));
|
||||
Assertions.assertTrue(object.toStringUnicode().contains(StringUnicode.valueOf("mens")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testObjectToObject2() {
|
||||
StringUnicode str = new StringUnicode("0123456789");
|
||||
for (int i=0;i<10;i++) {
|
||||
str = str.toStringUnicode();
|
||||
}
|
||||
Assertions.assertTrue(str != null);
|
||||
Assertions.assertEquals(20, str.toStringUnicode().lengthBytes());
|
||||
Assertions.assertEquals(10, str.toStringUnicode().lengthChars());
|
||||
Assertions.assertEquals(10, str.toStringUnicode().lengthCodePoints());
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue