[fix-14123] remove the equals and hashcode in Project pojo (#14167)
* [fix] remove the equals and hashcode in Project pojo * [fix]fix the Strict Problem in Mockito by using `doReturn()` instead of `when()` functionw --------- Co-authored-by: xuankun zheng <zhxuankun@gmail.com>
This commit is contained in:
parent
1cd5070b5d
commit
61118d4467
|
|
@ -383,8 +383,9 @@ public class ProcessDefinitionServiceTest extends BaseServiceTestTool {
|
|||
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject(projectCode));
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
putMsg(result, Status.SUCCESS, projectCode);
|
||||
Mockito.when(projectService.checkProjectAndAuth(user, project, projectCode, WORKFLOW_BATCH_COPY))
|
||||
.thenReturn(result);
|
||||
Mockito.doReturn(result)
|
||||
.when(projectService)
|
||||
.checkProjectAndAuth(user, project, projectCode, WORKFLOW_BATCH_COPY);
|
||||
|
||||
// copy project definition ids empty test
|
||||
Map<String, Object> map =
|
||||
|
|
@ -402,8 +403,9 @@ public class ProcessDefinitionServiceTest extends BaseServiceTestTool {
|
|||
// project check auth success, target project name not equal project name, check auth target project fail
|
||||
Project project1 = getProject(projectCodeOther);
|
||||
Mockito.when(projectMapper.queryByCode(projectCodeOther)).thenReturn(project1);
|
||||
Mockito.when(projectService.checkProjectAndAuth(user, project, projectCodeOther, WORKFLOW_BATCH_COPY))
|
||||
.thenReturn(result);
|
||||
Mockito.doReturn(result)
|
||||
.when(projectService)
|
||||
.checkProjectAndAuth(user, project1, projectCodeOther, WORKFLOW_BATCH_COPY);
|
||||
|
||||
putMsg(result, Status.SUCCESS, projectCodeOther);
|
||||
ProcessDefinition definition = getProcessDefinition();
|
||||
|
|
|
|||
|
|
@ -96,29 +96,4 @@ public class Project {
|
|||
*/
|
||||
@TableField(exist = false)
|
||||
private int instRunningCount;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Project project = (Project) o;
|
||||
|
||||
if (id != project.id) {
|
||||
return false;
|
||||
}
|
||||
return name.equals(project.name);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = id;
|
||||
result = 31 * result + name.hashCode();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue