Skip to content

Commit

Permalink
增加单元测试
Browse files Browse the repository at this point in the history
  • Loading branch information
justice-eddy committed Jan 11, 2017
1 parent 5002cd4 commit a1d4c9c
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions foundation/src/test/java/org/eddy/test/BeansTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package org.eddy.test;

import org.eddy.entity.pojo.User;
import org.eddy.entity.provider.define.TypeProvider;
import org.eddy.util.BeansUtil;
import org.junit.Assert;
import org.junit.Test;
import org.springframework.beans.BeanUtils;

import java.beans.IntrospectionException;
import java.lang.reflect.InvocationTargetException;

/**
* Created by eddy on 17/1/11.
*/
public class BeansTest {

@Test
public void test() throws IllegalAccessException, IntrospectionException, InvocationTargetException {
User user = new User();
user.setName("eddy");
TypeProvider typeProvider = BeansUtil.readPropertieWithType(user, "name");
Assert.assertEquals("eddy", typeProvider.get());
}

@Test
public void test2() throws Exception {
User user = new User();
user.setName("eddy");
String value = BeansUtil.readPropertie4String(user, "name");
Assert.assertEquals("eddy", value);
}
}

0 comments on commit a1d4c9c

Please sign in to comment.