Просмотр исходного кода

Merge branch 'Develop' into 'Test'

Develop



See merge request !1163

menduo 5 лет назад
Родитель
Сommit
db5db153f4

+ 8 - 2
mooctest-site-server/src/test/java/cn/iselab/mooctest/site/web/logic/impl/ThemeLogicImplTest.java

@@ -10,9 +10,12 @@ import cn.iselab.mooctest.site.web.data.CourseResourceVO;
 import cn.iselab.mooctest.site.web.data.ThemeVO;
 import cn.iselab.mooctest.site.web.data.wrapper.CourseResourceVOWrapper;
 import cn.iselab.mooctest.site.web.data.wrapper.ThemeVOWrapper;
+import cn.iselab.mooctest.site.web.exception.HttpForbiddenException;
 import cn.iselab.mooctest.site.web.logic.ThemeLogic;
 import com.google.common.collect.Lists;
+import org.junit.Rule;
 import org.junit.Test;
+import org.junit.rules.ExpectedException;
 import org.junit.runner.RunWith;
 import org.mockito.InjectMocks;
 import org.mockito.Mock;
@@ -47,6 +50,8 @@ public class ThemeLogicImplTest {
     @Mock
     private ThemeVOWrapper themeVOWrapper;
 
+    @Rule
+    public ExpectedException thrown= ExpectedException.none();
 
     @Test
     public void test_getTheme() {
@@ -84,7 +89,8 @@ public class ThemeLogicImplTest {
         when(courseResourceService.getCourseResourceByResourceId(1L)).thenReturn(courseResource);
         when(courseResourceVOWrapper.wrap(courseResource)).thenReturn(courseResourceVO);
         when(themeService.checkRelationBetweenThemeAndEntity(1L, 1L, EntityTypeEnum.COURSE_RESOURCE)).thenReturn(themeEntityRelations);
-        CourseResourceVO courseResource1 = themeLogic.getCourseResource(1L,1L);
-        assertEquals(courseResource.getId(),courseResource1.getId());
+        thrown.expect(HttpForbiddenException.class);
+        thrown.expectMessage("This Course should buy and resource can't preview");
+        themeLogic.getCourseResource(1L,1L);
     }
 }