BAEL-5734 - Mocking private fields (#14085)

* BAEL-5734 - Mocking private fields

* BAEL-5734 - reducing spring version to make it compatible
This commit is contained in:
Abhinav Pandey
2023-06-05 09:12:47 +05:30
committed by GitHub
parent 3ddf5fa6a4
commit 104df66ef8
4 changed files with 93 additions and 0 deletions
@@ -0,0 +1,10 @@
package com.baeldung.mockprivate;
public class MockService {
private final Person person = new Person("John Doe");
public String getName() {
return person.getName();
}
}
@@ -0,0 +1,14 @@
package com.baeldung.mockprivate;
public class Person {
private final String name;
public Person(String name) {
this.name = name;
}
public String getName() {
return name;
}
}