You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+63-8
Original file line number
Diff line number
Diff line change
@@ -40,25 +40,38 @@ DZone Article(s):
40
40
41
41
### 1. Mocking Real-World Objects
42
42
43
-
The library supports several ways of filling/mocking the "model layer" of your application with relevant data.
43
+
The library supports several ways of filling/mocking the "model layer" of your application with relevant data. (*Note*: In the following examples `User` is a *custom* bean class from the "model layer").
44
44
45
45
a) Using some "lambda magic" and referencing the setter methods:
46
46
47
47
```java
48
48
MockNeat m =MockNeat.threadLocal();
49
49
50
-
User user1 = m.filler(() ->newUser())
50
+
User user1 = m.filler(() ->newUser())// Object is created throught the supplier
.val();// When val() is called all the setters are applied in order over the object created with the supplier
57
57
58
58
// Output:
59
59
// User{userName='toomjefferey', firstName='Lia', lastName='Noyd', created=Tue May 08 00:00:00 EEST 2018, modified=Fri Mar 23 00:00:00 EET 2018}
60
60
```
61
61
62
+
Creating a `List<User>` is easy. We just collect the results using the `list()` method. Actually we can collect the results in a different structures and collections. Check the `MockUnit<T>`[interface documentation](https://github.com/nomemory/mockneat/wiki/MockUnit) for all the options:
0 commit comments