Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[type: test] Add unit test for NacosDiscoveryService #5310

Merged
merged 8 commits into from
Nov 21, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test ci
  • Loading branch information
eurecalulu committed Nov 20, 2023
commit 2dae7208a50bc339fc1df24c41676f304f1b27e2
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ void testRegister() throws NacosException {
nacosDiscoveryServiceUnderTest.register(key, value);
// Verify whether the method is called correctly
verify(namingService).registerInstance(anyString(), anyString(), any(Instance.class));
// Mock the wrong json format
assertThrows(ShenyuException.class, () -> nacosDiscoveryServiceUnderTest.register(key, "test"));
// Mock the throwing of registerInstance exception
doThrow(new NacosException()).when(namingService).registerInstance(anyString(), anyString(), any(Instance.class));
assertThrows(ShenyuException.class, () -> nacosDiscoveryServiceUnderTest.register(key, value));
Expand Down Expand Up @@ -237,4 +239,3 @@ private String buildInstanceInfoJson(final Instance instance) {
}

}