REM:
1. 增加配置文件单元测试用例
2. 满足单元测试代码覆盖率要求
This commit is contained in:
huangxin 2020-04-22 19:41:52 +08:00
parent afee2acf8b
commit fcd5ef71fe
4 changed files with 37 additions and 1 deletions

View File

@ -1,6 +1,7 @@
package com.dispose.TestSuit;
import com.dispose.config.DisposeConfigureTest;
import com.dispose.config.MyConfigTest;
import com.dispose.controller.AuthControllerTest;
import com.dispose.controller.DeviceNodeInfoControllerTest;
@ -21,6 +22,7 @@ import org.junit.runners.Suite;
@RunWith(Suite.class)
@Suite.SuiteClasses({
MyConfigTest.class,
DisposeConfigureTest.class,
GetVersionTest.class,
DPTechInterfaceTestCase.class,
UserAccountMapperTest.class,

View File

@ -0,0 +1,29 @@
package com.dispose.config;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import javax.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.junit.Assert;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.MethodSorters;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@Slf4j
@SpringBootTest
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class DisposeConfigureTest {
@Resource
private DisposeConfigure disposeConfigure;
@Test
public void t1_disposeCfgTest() throws JsonProcessingException {
Assert.assertNotNull(disposeConfigure);
log.info(new ObjectMapper().writeValueAsString(disposeConfigure));
}
}

View File

@ -1,5 +1,7 @@
package com.dispose.config;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import javax.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.junit.Assert;
@ -19,7 +21,9 @@ public class MyConfigTest {
private MyConfig myConfig;
@Test
public void t1_myConfigTest() {
public void t1_myConfigTest() throws JsonProcessingException {
Assert.assertNotNull(myConfig);
log.info(new ObjectMapper().writeValueAsString(myConfig));
}
}

View File

@ -101,6 +101,7 @@ public class UserAccountManagerTest extends InitTestEnvironment {
@Test
public void t6_getUsrPwdErrTimesTest() {
Assert.assertEquals(userAccountCacheManager.getUsrPwdErrTimes(getUSER_NAME()), 0);
Assert.assertEquals(userAccountCacheManager.getUsrPwdErrTimes(getUSER_NAME() + "abc"), 0);
}
/**