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

Create test classes for MNodeResourceHandler and CNodeResourceHanlder #1793

Open
taojing2002 opened this issue Feb 1, 2024 · 1 comment
Open
Milestone

Comments

@taojing2002
Copy link
Contributor

We don't have test classes for the MNodeResourceHandler and CNodeResourceHanlder classes. Matthew and I think it is a good idea to write them. And Mockito is good candidate to handle this situation. Here is some code we can borrow.

Since we have so many rest commands needed to be tested, we will gradually add them. The start the point will be the new ones of reindex and updateIdMetadata.

@taojing2002 taojing2002 added this to the 3.0.0 milestone Feb 1, 2024
@taojing2002
Copy link
Contributor Author

taojing2002 commented Feb 1, 2024

Matthew wrote some example here:

try (MockedStatic<MNodeService> ignored = Mockito.mockStatic(MNodeService.class)) {
            MNodeService mockMNodeService = Mockito.mock(MNodeService.class);
            Mockito.when(MNodeService.getInstance()).thenReturn(mockMNodeService);
            Mockito.when(mockMNodeService).reindex(any(), any()).thenReturn(Boolean.TRUE);

            // Verify that reindex() was called
            Mockito.verify(mockMNodeService, Mockito.times(1)).reindex(any(), any());
        }

@artntek artntek modified the milestones: 3.0.0, 3.1.0 Feb 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants