Commit 87b036f8 authored by 技术部-任文超's avatar 技术部-任文超

临时提交

parent 8ad78914
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
//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));
// }
//
//
//}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment