есть интерфейс
public interface Authorization {
UserDto authorization(UserDto userDto) throws IOException,NullPointerException;
}
его реализация
@Component
public class AuthorizationImpl extends RestClient implements Authorization {
private final String url = "/share/page/dologin";
private static ObjectMapper om = new ObjectMapper();
public UserDto userDto ;
protected Response responce;
public UserDto authorization(UserDto user) {
responce =
given().contentType("application/x-www-form-urlencoded;charset=UTF-8").baseUri(RestClient.baseUri).body(user)
.when().post(url);
user.setJSESSIONID(responce.getSessionId());
System.out.println(responce.getSessionId());
return user;
}
}
сам тест
@ContextConfiguration(locations = "ru.sibintek.ksed.testBeans.xml")
public class ApprovalCart2layers {
private UserDto userDto;
@Autowired
protected AuthorizationImpl auth;
@Test
public void testName() throws IOException,NullPointerException {
UserDto mike = new UserDto();
mike.setPassword("111");
mike.setLogin("111");
auth.authorization(mike);
}
}
при запуске - NullPointerException
помогите разобраться почему