- private void setGroupToReturnNonNullValueForGetGroupMatching() {
- PowerMockito.mockStatic(Group.class);
- Group group = mock(Group.class);
- PowerMockito.when(Group.getGroupById(anyInt())).thenReturn(group);
- PowerMockito.when(Group.getGroupMatching(Matchers.any(Group.class), anyInt())).thenReturn(group);
+ private GroupServlet overideGetJSONFromInputToReturnNewGroupToInsert() {
+ GroupServlet groupServlet = new GroupServlet() {
+ protected JSONObject getJSONfromInput(HttpServletRequest req) {
+ JSONObject validGroup = new JSONObject();
+ validGroup.put("name", "Group2");
+ validGroup.put("groupid", 2);
+ validGroup.put("description", "Second group to be added");
+ validGroup.put("authid", "Basic dXNlcjE6cGFzc3dvcmQx");
+ validGroup.put("classification", "Class2");
+ validGroup.put("members", "Member2");
+ return validGroup;
+ }
+ };
+ return groupServlet;