-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5002cd4
commit a1d4c9c
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |