|
@@ -3,6 +3,7 @@ package cn.iselab.mooctest.site.web.logic.impl;
|
|
|
|
|
|
import cn.iselab.mooctest.site.data.GeneralGradeDTO;
|
|
import cn.iselab.mooctest.site.data.GeneralGradeDTO;
|
|
import cn.iselab.mooctest.site.service.*;
|
|
import cn.iselab.mooctest.site.service.*;
|
|
|
|
+import cn.iselab.mooctest.site.util.data.CacheUtil;
|
|
import cn.iselab.mooctest.site.web.data.forMongo.CaseGraphDTO;
|
|
import cn.iselab.mooctest.site.web.data.forMongo.CaseGraphDTO;
|
|
import cn.iselab.mooctest.site.web.data.forMongo.NodeCatch.CatchDTO;
|
|
import cn.iselab.mooctest.site.web.data.forMongo.NodeCatch.CatchDTO;
|
|
import cn.iselab.mooctest.site.web.data.forMongo.NodeCatch.UserCatchDTO;
|
|
import cn.iselab.mooctest.site.web.data.forMongo.NodeCatch.UserCatchDTO;
|
|
@@ -50,6 +51,8 @@ public class GeneralCalculateScoreComponentTest {
|
|
private LatestStrategy latestStrategy;
|
|
private LatestStrategy latestStrategy;
|
|
@Mock
|
|
@Mock
|
|
private HighestStrategy highestStrategy;
|
|
private HighestStrategy highestStrategy;
|
|
|
|
+ @Mock
|
|
|
|
+ private CacheUtil cacheUtil;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -70,9 +73,9 @@ public class GeneralCalculateScoreComponentTest {
|
|
|
|
|
|
//初始化反射类及其成员变量
|
|
//初始化反射类及其成员变量
|
|
instance = generalCalculateScoreComponentClass.newInstance();
|
|
instance = generalCalculateScoreComponentClass.newInstance();
|
|
- Field caseGraphServiceField = generalCalculateScoreComponentClass.getDeclaredField
|
|
|
|
- ("caseGraphService");
|
|
|
|
- caseGraphServiceField.set(instance, caseGraphService);
|
|
|
|
|
|
+// Field caseGraphServiceField = generalCalculateScoreComponentClass.getDeclaredField
|
|
|
|
+// ("caseGraphService");
|
|
|
|
+// caseGraphServiceField.set(instance, caseGraphService);
|
|
|
|
|
|
Field catchServiceField= generalCalculateScoreComponentClass.getDeclaredField("catchService");
|
|
Field catchServiceField= generalCalculateScoreComponentClass.getDeclaredField("catchService");
|
|
catchServiceField.set(instance, catchService);
|
|
catchServiceField.set(instance, catchService);
|
|
@@ -84,6 +87,10 @@ public class GeneralCalculateScoreComponentTest {
|
|
("highestStrategy");
|
|
("highestStrategy");
|
|
field2.set(instance, highestStrategy);
|
|
field2.set(instance, highestStrategy);
|
|
|
|
|
|
|
|
+ Field field3 = generalCalculateScoreComponentClass.getDeclaredField
|
|
|
|
+ ("cacheUtil");
|
|
|
|
+ field3.set(instance, cacheUtil);
|
|
|
|
+
|
|
basicNode.setCaseId(1L);
|
|
basicNode.setCaseId(1L);
|
|
Category c1 = new Category("c1", 1);
|
|
Category c1 = new Category("c1", 1);
|
|
Category c2 = new Category("c2", 1);
|
|
Category c2 = new Category("c2", 1);
|
|
@@ -153,7 +160,7 @@ public class GeneralCalculateScoreComponentTest {
|
|
|
|
|
|
@Test
|
|
@Test
|
|
public void should_calculateTypeScore_when_givenData() throws Exception {
|
|
public void should_calculateTypeScore_when_givenData() throws Exception {
|
|
- when(caseGraphService.getCaseGraph(1L)).thenReturn(basicNode);
|
|
|
|
|
|
+ when(cacheUtil.getMetaNode(1L)).thenReturn(basicNode);
|
|
when(catchService.findById("5b2fdac0d7fa0b6acb628193")).thenReturn(catchDTOList);
|
|
when(catchService.findById("5b2fdac0d7fa0b6acb628193")).thenReturn(catchDTOList);
|
|
|
|
|
|
Method method = generalCalculateScoreComponentClass.getDeclaredMethod("calculateTypeScore",
|
|
Method method = generalCalculateScoreComponentClass.getDeclaredMethod("calculateTypeScore",
|