Skip to content

eupadhyaya/JavaObjectMockFakeData

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java Object Mock Fake Data

This code helps to create the fake data to any class with the below types.

  • Integer.class
  • int.class
  • Long.class
  • long.class
  • String.class
  • Double.class
  • double.class
  • BigDecimal.class
  • Boolean.class
  • boolean.class
  • List.class
  • Set.class
  • Queue.class
  • MultipartFile.class
  • any declared class

Two features has been added.

  1. Pass the class, create fake data.

MockBeanData mockBean = new MockBeanData(); SampleBean sampleBean = (SampleBean) mockBean.createMockData(SampleBean.class);

sampleBean has the autogenerated fake data.

  1. Pass the class and custom field values, create fake data with the custom field values provided on top.

MockBeanData mockBean = new MockBeanData(); Map<String, Object> customValues = new HashMap<String, Object>(); customValues.put("name", "custom data"); SampleBean sampleBean = (SampleBean) mockBean.createMockData(SampleBean.class, customValues);

sampleBean has the autogenerated fake data with where ever the name property will have the "custom data" as value.