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:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user