use of org.apache.geode.internal.cache.GridAdvisor.GridProfile in project geode by apache.
the class GridProfileTest method shouldBeMockable.
@Test
public void shouldBeMockable() throws Exception {
GridProfile mockGridProfile = mock(GridProfile.class);
ProfileId mockProfileId = mock(ProfileId.class);
List<Profile> listOfProfiles = new ArrayList<>();
listOfProfiles.add(mock(Profile.class));
when(mockGridProfile.getHost()).thenReturn("HOST");
when(mockGridProfile.getPort()).thenReturn(1);
when(mockGridProfile.getId()).thenReturn(mockProfileId);
mockGridProfile.setHost("host");
mockGridProfile.setPort(2);
mockGridProfile.tellLocalControllers(true, true, listOfProfiles);
mockGridProfile.tellLocalBridgeServers(true, true, listOfProfiles);
verify(mockGridProfile, times(1)).setHost("host");
verify(mockGridProfile, times(1)).setPort(2);
verify(mockGridProfile, times(1)).tellLocalControllers(true, true, listOfProfiles);
verify(mockGridProfile, times(1)).tellLocalBridgeServers(true, true, listOfProfiles);
assertThat(mockGridProfile.getHost()).isEqualTo("HOST");
assertThat(mockGridProfile.getPort()).isEqualTo(1);
assertThat(mockGridProfile.getId()).isSameAs(mockProfileId);
}
Aggregations