forked from 2010yhh/springBoot-demos
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
418 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
server.port=8090 | ||
#server.context-path=/test-shiro | ||
##tomcat## | ||
server.tomcat.uri-encoding=UTF-8 | ||
##Druid## | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
springboot-druid/src/test/java/com/ctg/test/durid/Junit4TestCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package com.ctg.test.durid; | ||
|
||
/** | ||
* @Description: junit4单元测试 | ||
* @Author: yanhonghai | ||
* @Date: 2019/3/12 9:30 | ||
*/ | ||
import org.junit.*; | ||
|
||
public class Junit4TestCase { | ||
|
||
@BeforeClass | ||
public static void setUpBeforeClass() { | ||
System.out.println("Set up before class"); | ||
} | ||
|
||
@Before | ||
public void setUp() throws Exception { | ||
System.out.println("Set up"); | ||
} | ||
|
||
@Test | ||
public void testMathPow() { | ||
System.out.println("Test Math.pow"); | ||
Assert.assertEquals(4.0, Math.pow(2.0, 2.0), 0.0); | ||
} | ||
|
||
@Test | ||
public void testMathMin() { | ||
System.out.println("Test Math.min"); | ||
Assert.assertEquals(2.0, Math.min(2.0, 4.0), 0.0); | ||
} | ||
|
||
// 期望此方法抛出NullPointerException异常 | ||
@Test(expected = NullPointerException.class) | ||
public void testException() { | ||
System.out.println("Test exception"); | ||
Object obj = null; | ||
obj.toString(); | ||
} | ||
|
||
// 忽略此测试方法 | ||
@Ignore | ||
@Test | ||
public void testMathMax() { | ||
Assert.fail("没有实现"); | ||
} | ||
// 使用“假设”来忽略测试方法 | ||
@Test | ||
public void testAssume(){ | ||
System.out.println("Test assume"); | ||
// 当假设失败时,则会停止运行,但这并不会意味测试方法失败。 | ||
Assume.assumeTrue(false); | ||
Assert.fail("没有实现"); | ||
} | ||
|
||
@After | ||
public void tearDown() throws Exception { | ||
System.out.println("Tear down"); | ||
} | ||
|
||
@AfterClass | ||
public static void tearDownAfterClass() { | ||
System.out.println("Tear down After class"); | ||
} | ||
|
||
} |
Oops, something went wrong.