1 Reply Latest reply on Jan 2, 2015 5:13 AM by Jorge Morales

    Test case for mocking a bean

    venu surampudi Newbie

      I have a switchyard route built in java that that calls helper beans which do things like validating the request, setting some exchange properties etc. I now want to mock these beans in my test cases to ensure that my camel flow goes down the right logical path


      My camel route looks like


                          .bean(builder.class, "method")


                                  .when ( flag)  // This flag is built in the "method" of the builder class)

                                         xxx logic


                                         yyy logic



      In my test case i want to mock the builder.class and set the flag to true ( and make sure xxx is executed ) and false ( to ensure yyy is executed ). Any ideas how to accomplish this would be of great help