Adven27 / grpc-wiremock

gRPC Mock Server
MIT License
93 stars 40 forks source link

how can i run this in intellij using a unit test #37

Open ankitanuj30 opened 2 years ago

ankitanuj30 commented 2 years ago

i wanted to run this code in intellij using a unit test case. but it require some commandline arguments can you please provide the command line arguments to run this in proper format

toronik commented 2 years ago

Hi @ankitanuj30 , could you please elaborate on what you are trying to run? Run the docker image in tests? Run the springboot service in tests? Run some specific classes in tests?

To run springboot service you can:

  1. comment the line https://github.com/Adven27/grpc-wiremock/blob/master/build.gradle#L41
  2. uncomment the following block https://github.com/Adven27/grpc-wiremock/blob/master/build.gradle#L42
  3. run gradle bootRun or start springboot service from test programmatically.
ankitanuj30 commented 2 years ago

hi @toronik , i want to run a unit test case using command line args, and i dont know know what command line args i need to pass for running the unit test case using spring boot service I am just trying to run and debug the main function of GrpcWireMock.java class in which some commands line args need to be passed, just help me with this

toronik commented 2 years ago

@ankitanuj30 did you try to pass none? This should work:

    @Test
    void test() {
        GrpcWiremock.main(new String[] {});
    }

or you can pass application properties:

    @Test
    void test() {
        GrpcWiremock.main(new String[] {"--grpc.server.port=3000"});
    }