1 Reply Latest reply on Aug 22, 2016 4:28 AM by Sebastian Łaskawiec

    best way to Mock Infinispan for testing?

    Bruce Springfield Apprentice

      I need to mock Infinispan for software testing. Any ideas on the best way to mock it?

       

      In particular I need to mock org.infinispan.client.hotrod.RemoteCache.

        • 1. Re: best way to Mock Infinispan for testing?
          Sebastian Łaskawiec Apprentice

          You have a couple of options:

          1. RemoteCache is an interface. So it's perfect for mocking (just provide your own implementation or use Mockito.mock).
          2. Use BasicCache in your code. This interface is a common root for both Remote and Embedded Cache. Use the Embedded Cache in your testing code (just create a DefaultCacheManager and call #getCache method).
          3. The last proposition is very heavyweight. You can start a HotRod server (using Failsafe maven plugin for example) and run all the tests against it.