How do you create a Hazelcast instance embedded in-process/in-memory, without networking?

后端 未结 6 754
深忆病人
深忆病人 2021-02-14 02:09

In my unit tests, I want to create an embedded (in-process/in-memory) Hazelcast instance that does not attempt to start or perform any networking operations at all.

How

6条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-14 02:24

    I was able to do the same with Mockito. For example, with a Topic:

    HazelcastInstance hazelcastInstance = Mockito.mock(HazelcastInstance.class);
    Mockito.when(hazelcastInstance.getTopic("yourtopic")).thenReturn(Mockito.mock(ITopic.class));
    

提交回复
热议问题