Role extends AbstractAuthzEntity { @Override @Transient @JsonIgnore public User getOwner() { if (application != null) { return application.getOwner(); } return null; }  Application getApplication(); void setApplication(final Application application); String getName(); void setName(final String name); List<User> getUsers(); void setUsers(final List<User> users); SortedMap<String, ApplicationScope> getScopes(); void setScopes(final SortedMap<String, ApplicationScope> scopes); @Override @Transient @JsonIgnore User getOwner();  }
@Test public void testGetOwner() { Role role = new Role(); Application spy = spy(new Application()); assertNull(role.getOwner()); role.setApplication(spy); role.getOwner(); Mockito.verify(spy).getOwner(); }