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) -

'hasOwnProperty' in javascript -

android - Unable to generate FCM token from dynamically instantiated Firebase -