use of org.apache.geode.management.internal.cli.util.MemberNotFoundException in project geode by apache.
the class DiskStoreCommandsJUnitTest method testGetDiskStoreDescriptionThrowsMemberNotFoundException.
@Test(expected = MemberNotFoundException.class)
public void testGetDiskStoreDescriptionThrowsMemberNotFoundException() {
final String diskStoreName = "mockDiskStore";
final String memberId = "mockMember";
final InternalCache mockCache = mockContext.mock(InternalCache.class, "InternalCache");
final DistributedMember mockMember = mockContext.mock(DistributedMember.class, "DistributedMember");
mockContext.checking(new Expectations() {
{
oneOf(mockMember).getName();
will(returnValue(null));
oneOf(mockMember).getId();
will(returnValue("testMember"));
}
});
final DiskStoreCommands commands = createDiskStoreCommands(mockCache, mockMember, null);
try {
commands.getDiskStoreDescription(memberId, diskStoreName);
} catch (MemberNotFoundException expected) {
assertEquals(CliStrings.format(CliStrings.MEMBER_NOT_FOUND_ERROR_MESSAGE, memberId), expected.getMessage());
throw expected;
}
}
use of org.apache.geode.management.internal.cli.util.MemberNotFoundException in project geode by apache.
the class GfshCommandJUnitTest method testGetMemberThrowsMemberNotFoundException.
@Test(expected = MemberNotFoundException.class)
public void testGetMemberThrowsMemberNotFoundException() {
final InternalCache mockCache = mockContext.mock(InternalCache.class, "InternalCache");
final DistributedSystem mockDistributedSystem = mockContext.mock(DistributedSystem.class, "DistributedSystem");
final DistributedMember mockMemberSelf = createMockMember("S", "Self");
final DistributedMember mockMemberOne = createMockMember("1", "One");
final DistributedMember mockMemberTwo = createMockMember("2", "Two");
mockContext.checking(new Expectations() {
{
oneOf(mockCache).getMembers();
will(returnValue(CollectionUtils.asSet(mockMemberOne, mockMemberTwo)));
oneOf(mockCache).getDistributedSystem();
will(returnValue(mockDistributedSystem));
oneOf(mockDistributedSystem).getDistributedMember();
will(returnValue(mockMemberSelf));
}
});
final GfshCommand commands = createAbstractCommandsSupport(mockCache);
try {
commands.getMember(mockCache, "zero");
} catch (MemberNotFoundException expected) {
assertEquals(CliStrings.format(CliStrings.MEMBER_NOT_FOUND_ERROR_MESSAGE, "zero"), expected.getMessage());
throw expected;
}
}
Aggregations