У меня есть Spring Data JPA с тестом JUnit 5: [code]@Transactional @Repository public interface AddressRepository extends EntityRepository, JpaRepository {
@Query(value = """ SELECT id, name from test where :id """, nativeQuery = true) Optional get(@Param("id") String id); }
.....
public interface AddressView {
String getName(); ..... }
.........
public class AddressWrapper extends SimpleEntityWrapper {
private String street;
@Override public void applyWrapper(final Address obj) { if (!StringUtils.isBlank(region) && (!obj.getCountry().isUs())) { obj.setStreet(region); } }
public void setRegion(String street) { this.street= street; } }
...........
public class SimpleEntityWrapper {
private String id; private EntityT obj;
public String getId() { return idString; }
public void setId(final String id) { this.id = id; }
public EntityT getObj() { return obj; }
public void setObj(final EntityT obj) { this.obj = obj; }
public void applyWrapper(final EntityT obj) { //none }
}
......
private final AddressWrapper addressWrapper1 = new AddressWrapper();
@Test public void addressRequest() { when(addressRepository.get(@Param("id") String id......)).thenReturn(addressWrapper1); } [/code] Я ошибаюсь: [code]Cannot resolve method 'thenReturn(AddressWrapper)' [/code] Знаете, как я могу решить эту проблему?