Giter VIP home page Giter VIP logo

jmockdata's Introduction

Jmockdata

Jmockdta是一款实现模拟JAVA类型或对象的实例化并随机初始化对象的数据的工具框架。单元测试的利器。
The plug-in of Jmockdata what through random algorithm mock java data.
Jmockdata插件通过随机算法模拟Java数据.

示例可以参考单元测试内容,具体介绍和用法可以参考如下:

  1. 模拟数据入口方法 JMockData.mock(JmockDataWrapper)
  2. 被模拟数据必须继承JmockDataWrapper经过它的包装
  3. 被模拟的数据最好是plain bean,只提供getter,setter,has,is方法的才可以被模拟
  4. 框架默认实现了40个元数据类型的数据模拟器包括:
 short.class,Short.class,short[].class,Short[].class,  
 int.class,Integer.class,int[].class,Integer[].class,  
 long.class,Long.class,long[].class,Long[].class,  
 float.class,Float.class,float[].class,Float[].class,  
 double.class,Double.class,double[].class,Double[].class,  
 boolean.class,Boolean.class,boolean[].class,Boolean[].class,  
 char.class,Character.class,char[].class,Character[].class,  
 String.class,String[].class,  
 BigDecimal.class,BigDecimal[].class,  
 BigInteger.class,BigInteger[].class,  
 Date.class,Date[].class  

通过对以上基本元数据类型的模拟实现,能够进一步实现BEAN,LIST,SET,ARRAY等结构的模拟。
4. 可以通过JmockDataContext 获取模拟过程的所有上下文信息,甚至可以打印整个模拟类型树
5. 可以通过JMockDataManager 注册模拟数据类型,重写模拟数据算法,注册模拟数据类拦截器等 6. 可以通过实现MockData来实现一个模拟数据类型 7. 可以通过实现JmockDataTemplate,或者继承JmockDataTemplateDefault来重写模拟数据算法 8. 可以通过实现JmockDataInterceptor来实现一个拦截器 9. 具体示例实践请参考https://github.com/jsonzou/jmockdata-demo 10. 有问题或者对本框架有新的想法,请联系我, 作者:jsonzou

jmockdata's People

Contributors

jsonzoup avatar

Watchers

James Cloos avatar yangsong158 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.