Initial project

This commit is contained in:
Timi
2025-07-12 12:45:46 +08:00
parent a87693cf37
commit abf09cee04
20 changed files with 2769 additions and 94 deletions

View File

@ -0,0 +1,40 @@
package test;
import lombok.AllArgsConstructor;
import lombok.Data;
import com.imyeyu.utils.AsciiTable;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import java.util.List;
/**
* @author 夜雨
* @since 2024-12-18 12:47
*/
public class TestAsciiTable {
@Test
public void testTable() throws Exception {
List<Item> dataList = new ArrayList<>();
dataList.add(new Item("r1 f1 value", "r1 f2 value"));
dataList.add(new Item("r2 f1 value", "r2 f2 value"));
dataList.add(new Item("r3 f1 value", "r3 f2 value333333"));
dataList.add(new Item("r4 f1 value", "r4 f2 value"));
AsciiTable<Item> table = new AsciiTable<>();
table.addHeader("f1 bbbbbbbbbbbbbbbbbbbbbbbbbbbb", "f1");
table.addHeader("f2");
String result = table.render(dataList);
System.out.println(result);
}
@Data
@AllArgsConstructor
public static class Item {
String f1;
String f2;
}
}

View File

@ -0,0 +1,47 @@
package test;
import com.imyeyu.utils.StringInterpolator;
import com.imyeyu.utils.Text;
import org.junit.jupiter.api.Test;
import java.util.HashMap;
import java.util.Map;
/**
* @author 夜雨
* @since 2024-09-04 17:50
*/
public class TestText {
@Test
public void testStringInterpolator() {
String template = "test ${item.name} deep arg";
StringInterpolator interpolator = new StringInterpolator(StringInterpolator.DOLLAR_OBJ);
Map<String, Object> argsMap = new HashMap<>();
Item item = new Item();
item.name = "deepName";
argsMap.put("item", item);
System.out.println(interpolator.inject(template, argsMap));
}
@Test
public void testCamelToUnderline() {
String str = "";
String result = "";
assert Text.camelCase2underscore(str).equals(result);
str = "hello";
result = "hello";
assert Text.camelCase2underscore(str).equals(result);
str = "helloWorldTest";
result = "hello_world_test";
assert Text.camelCase2underscore(str).equals(result);
}
public static class Item {
String name;
}
}

View File

@ -0,0 +1,8 @@
package test;
/**
* @author 夜雨
* @since 2024-12-19 22:10
*/
public class TestTime {
}