Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xyqb-user2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
head_group
xyqb-user2
Commits
87b036f8
Commit
87b036f8
authored
Jan 04, 2018
by
技术部-任文超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
临时提交
parent
8ad78914
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
115 additions
and
0 deletions
+115
-0
ParametersTest.java
src/test/java/demo/ParametersTest.java
+45
-0
UserApiServiceTests.java
src/test/java/service/UserApiServiceTests.java
+70
-0
No files found.
src/test/java/demo/ParametersTest.java
0 → 100644
View file @
87b036f8
package
demo
;
import
org.junit.Ignore
;
import
org.junit.jupiter.api.DisplayName
;
import
org.junit.jupiter.api.Tag
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.TestInfo
;
import
org.junit.runner.RunWith
;
import
org.junit.runners.Parameterized
;
import
java.util.Arrays
;
import
java.util.Collection
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertEquals
;
@Tag
(
"Parameters"
)
@RunWith
(
value
=
Parameterized
.
class
)
public
class
ParametersTest
{
private
String
key
;
private
int
value
;
public
ParametersTest
(
String
key
,
int
value
)
{
this
.
key
=
key
;
this
.
value
=
value
;
}
@Parameterized
.
Parameters
public
Collection
<
Object
[]>
data
()
{
Object
[][]
data
=
new
Object
[][]
{{
"1"
,
1
},
{
"2"
,
2
},
{
"3"
,
3
},
{
"4"
,
4
}};
return
Arrays
.
asList
(
data
);
}
@Test
public
void
pushTest
()
{
System
.
out
.
println
(
"Parameterized is : key="
+
key
+
", value="
+
value
);
}
// @Ignore("Not Ready to Run")
// @Test
// @DisplayName("My 1st JUnit 5 test! 😎")
// void myFirstTest(TestInfo testInfo) {
// assertEquals(2, Math.addExact(1, 1), "1 + 1 should equal 2");
// assertEquals("My 1st JUnit 5 test! 😎", testInfo.getDisplayName(), () -> "TestInfo is injected correctly");
// }
}
\ No newline at end of file
src/test/java/service/UserApiServiceTests.java
0 → 100644
View file @
87b036f8
//package service;
//
//import cn.quantgroup.xyqb.Bootstrap;
//import cn.quantgroup.xyqb.entity.Address;
//import cn.quantgroup.xyqb.model.UserFullInfo;
//import cn.quantgroup.xyqb.service.api.IUserApiService;
//import cn.quantgroup.xyqb.service.user.IAddressService;
//import cn.quantgroup.xyqb.service.user.IContactService;
//import com.google.common.collect.Lists;
//import lombok.extern.slf4j.Slf4j;
//import org.junit.Before;
//import org.junit.Test;
//import org.junit.runner.RunWith;
//import org.junit.runners.Parameterized;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.boot.test.context.SpringBootTest;
//import org.springframework.test.annotation.Rollback;
//import org.springframework.test.context.TestContextManager;
//import org.springframework.transaction.annotation.Transactional;
//
//import java.sql.Timestamp;
//import java.time.LocalDateTime;
//import java.util.Arrays;
//import java.util.Collection;
//import java.util.List;
//
///**
// * Created by xuran on 2017/12/26.
// */
//@SpringBootTest(classes = Bootstrap.class )
//@Slf4j
//@Rollback
//@Transactional
//@RunWith(Parameterized.class)
//public class UserApiServiceTests {
// private TestContextManager testContextManager;
// @Autowired
// private IUserApiService userInfoService;
//
// public UserApiServiceTests(UserFullInfo userInfo) {
// super();
// this.addressObj = addressObj;
// }
// @Before
// public void setUpContext() throws Exception {
// //this is where the magic happens, we actually do "by hand" what the spring runner would do for us,
// // read the JavaDoc for the class bellow to know exactly what it does, the method names are quite accurate though
// this.testContextManager = new TestContextManager(getClass());
// this.testContextManager.prepareTestInstance(this);
// }
// @Parameterized.Parameters
// public static Collection data() {
// UserFullInfo userInfo = new UserFullInfo();
// return Arrays.asList(new Object[][]{{userInfo}});
// }
//
//
// @Test
// public void testAddress() {
// userInfoService.save(addressObj);
// addressObj=addressService.findByUserId(addressObj.getUserId());
// System.out.println("测试地址"+addressObj);
// List<Long> userIds= Lists.newArrayList();
// userIds.add(123456L);
// List<Address> addresses= addressService.findByUserIds(userIds);
// System.out.println("测试地址集合"+addresses.get(0));
// }
//
//
//}
Write
Preview
Markdown
is supported
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