authenticate a user inside a test class

I am new to spring boot and testing and I have spring boot app (generated with JHipster) that uses authentication. I need to get the id of the current user. so this method inside userRepository returns the current user @Query(value = "select u.* from user u where u.username=?#{principal.username}", nativeQuery = true) User findConnectedUser(); here is… Read More authenticate a user inside a test class