Which class to Mock for to bypass Springboot security in integration tests -


@springboottest(webenvironment = random_port) @activeprofiles("test") class contextloadingspec extends specification {      @autowired     testresttemplate testresttemplate      def '/ should load context'() {         when:         responseentity<object> entity = testresttemplate.getforentity('/', object.class)          then:         entity.statuscode == httpstatus.ok     }      @testconfiguration     static class config {          @bean         resttemplatebuilder resttemplatebuilder() {             return new resttemplatebuilder()             .basicauthorization('user', 'xxxxxxxx')         }     } } 

creating testconfiguration doesn't seem correct me here. credentials should in 'application.yml' , authentication call should have been mocked. please suggest better way of writing test.


Comments

Popular posts from this blog

c# - Update a combobox from a presenter (MVP) -

How to understand 2 main() functions after using uftrace to profile the C++ program? -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -