Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
wwwanlingxiao
mall
Commits
4fc17554
Commit
4fc17554
authored
Jun 25, 2022
by
macro
Browse files
单元测试支持Junit5
parent
b9258854
Changes
5
Show whitespace changes
Inline
Side-by-side
mall-admin/src/test/com/macro/mall/PmsDaoTests.java
View file @
4fc17554
...
...
@@ -6,9 +6,7 @@ import com.macro.mall.dao.PmsMemberPriceDao;
import
com.macro.mall.dao.PmsProductDao
;
import
com.macro.mall.dto.PmsProductResult
;
import
com.macro.mall.model.PmsMemberPrice
;
import
org.junit.Assert
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.jupiter.api.Test
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -21,7 +19,8 @@ import java.math.BigDecimal;
import
java.util.ArrayList
;
import
java.util.List
;
@RunWith
(
SpringRunner
.
class
)
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertEquals
;
@SpringBootTest
public
class
PmsDaoTests
{
@Autowired
...
...
@@ -42,7 +41,7 @@ public class PmsDaoTests {
list
.
add
(
memberPrice
);
}
int
count
=
memberPriceDao
.
insertList
(
list
);
Assert
.
assertEquals
(
5
,
count
);
assertEquals
(
5
,
count
);
}
@Test
...
...
mall-demo/src/test/java/com/macro/mall/demo/MallDemoApplicationTests.java
View file @
4fc17554
...
...
@@ -2,14 +2,11 @@ package com.macro.mall.demo;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.macro.mall.model.PmsProduct
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.jupiter.api.Test
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.junit4.SpringRunner
;
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
public
class
MallDemoApplicationTests
{
private
Logger
logger
=
LoggerFactory
.
getLogger
(
MallDemoApplicationTests
.
class
);
...
...
mall-portal/src/test/java/com/macro/mall/portal/MallPortalApplicationTests.java
View file @
4fc17554
package
com.macro.mall.portal
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.jupiter.api.Test
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.junit4.SpringRunner
;
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
public
class
MallPortalApplicationTests
{
...
...
mall-portal/src/test/java/com/macro/mall/portal/PortalProductDaoTests.java
View file @
4fc17554
...
...
@@ -2,21 +2,19 @@ package com.macro.mall.portal;
import
com.macro.mall.portal.dao.PortalProductDao
;
import
com.macro.mall.portal.domain.PromotionProduct
;
import
org.junit.Assert
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.jupiter.api.Test
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
java.util.ArrayList
;
import
java.util.List
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertEquals
;
/**
* Created by macro on 2018/8/27.
* 前台商品查询逻辑单元测试
*/
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
public
class
PortalProductDaoTests
{
@Autowired
...
...
@@ -29,6 +27,6 @@ public class PortalProductDaoTests {
ids
.
add
(
28L
);
ids
.
add
(
29L
);
List
<
PromotionProduct
>
promotionProductList
=
portalProductDao
.
getPromotionProductList
(
ids
);
Assert
.
assertEquals
(
4
,
promotionProductList
.
size
());
assertEquals
(
4
,
promotionProductList
.
size
());
}
}
mall-search/src/test/java/com/macro/mall/search/MallSearchApplicationTests.java
View file @
4fc17554
...
...
@@ -2,8 +2,7 @@ package com.macro.mall.search;
import
com.macro.mall.search.dao.EsProductDao
;
import
com.macro.mall.search.domain.EsProduct
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.jupiter.api.Test
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate
;
...
...
@@ -13,7 +12,6 @@ import org.springframework.test.context.junit4.SpringRunner;
import
java.util.List
;
import
java.util.Map
;
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
public
class
MallSearchApplicationTests
{
@Autowired
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment