This commit is contained in:
Looly
2023-03-10 13:07:05 +08:00
parent 869b12000d
commit 35feac4eae
13 changed files with 123 additions and 336 deletions

View File

@@ -7,6 +7,7 @@ import lombok.Getter;
import lombok.Setter;
import lombok.SneakyThrows;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@@ -71,6 +72,7 @@ public class LambdaFactoryTest {
* @author nasodaengineer
*/
@RunWith(Parameterized.class)
@Ignore
public static class PerformanceTest {
@Parameterized.Parameter
@@ -140,6 +142,7 @@ public class LambdaFactoryTest {
@SuppressWarnings({"rawtypes", "unchecked", "Convert2MethodRef"})
@Test
@SneakyThrows
@Ignore
public void lambdaGetPerformanceTest() {
final Something something = new Something();
something.setId(1L);
@@ -216,6 +219,7 @@ public class LambdaFactoryTest {
@SuppressWarnings({"rawtypes", "unchecked"})
@Test
@SneakyThrows
@Ignore
public void lambdaSetPerformanceTest() {
final Something something = new Something();
something.setId(1L);

View File

@@ -348,4 +348,23 @@ public class XmlUtilTest {
Console.log(XmlUtil.format(doc));
}
@Test
public void xmlStrToBeanTest(){
final String xml = "<user><name>张三</name><age>20</age><email>zhangsan@example.com</email></user>";
final Document document = XmlUtil.readXML(xml);
final UserInfo userInfo = XmlUtil.xmlToBean(document, UserInfo.class);
Assert.assertEquals("张三", userInfo.getName());
Assert.assertEquals("20", userInfo.getAge());
Assert.assertEquals("zhangsan@example.com", userInfo.getEmail());
}
@Data
static class UserInfo {
private String id;
private String name;
private String age;
private String email;
}
}