浏览代码

Some tests added

Lauren Green 6 年前
父节点
当前提交
d75eec3d2b
共有 1 个文件被更改,包括 11 次插入3 次删除
  1. 11
    3
      src/test/java/com/example/demo/BakeryApplicationTests.java

+ 11
- 3
src/test/java/com/example/demo/BakeryApplicationTests.java 查看文件

@@ -1,9 +1,11 @@
1 1
 package com.example.demo;
2 2
 
3
-import org.apache.catalina.core.ApplicationContext;
3
+import com.example.demo.Controllers.BakerController;
4
+import com.example.demo.Controllers.MuffinController;
4 5
 import org.junit.Assert;
5 6
 import org.junit.Test;
6 7
 import org.junit.runner.RunWith;
8
+import org.springframework.beans.factory.annotation.Autowired;
7 9
 import org.springframework.boot.test.context.SpringBootTest;
8 10
 import org.springframework.test.context.junit4.SpringRunner;
9 11
 
@@ -11,11 +13,17 @@ import org.springframework.test.context.junit4.SpringRunner;
11 13
 @SpringBootTest
12 14
 public class BakeryApplicationTests {
13 15
 
14
-    private ApplicationContext applicationContext;
16
+    @Autowired
17
+    private BakerController bakerController;
18
+
19
+    @Autowired
20
+    private MuffinController muffinController;
21
+
15 22
 
16 23
     @Test
17 24
     public void contextLoads() {
18
-//        Assert.assertNull(applicationContext.);
25
+        Assert.assertNotNull(bakerController);
26
+        Assert.assertNotNull(muffinController);
19 27
     }
20 28
 
21 29
 }