Sprint JPA Test

611 ワード

詳細
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration
public class TestUserService {
	@Configuration
	@ComponentScan(basePackages = { "com.yxt" })
	static class ContextConfiguration {
	}

	@Autowired
	UserService userService;

	@Test
	public void testFindAll() throws ApiException {
		List list = userService.findAll();
		Assert.assertTrue(list.size() > 0);
		for (User user : list) {
			System.out.println(user.getEmail());
		}
	}

}