mercredi 5 août 2020

How to write groovy test for main class of Spring-boot application thast uses CommandLineRunner

My class is like:

@SpringBootApplication
class Test implements CommandLineRunner {

 public static void main(String[] args) {
        SpringApplication.run(Test.class, args);
    }

    @Override
    public void run(String... args) throws Exception {
        //some code
    }

}

How do I pass argument to run method. Currently written test as:

 def "loads for class"() {
        expect:
        true
    }

but it can't find the args for run method and fails.

Aucun commentaire:

Enregistrer un commentaire