PageRenderTime 49ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/mybatis-practice/src/test/java/com/doctor/manager/impl/AuthorManagerImplTest.java

https://gitlab.com/doctorwho1986/doctor
Java | 45 lines | 35 code | 10 blank | 0 comment | 0 complexity | 3c00e53ddaacdb7e6eb608817372c031 MD5 | raw file
  1. package com.doctor.manager.impl;
  2. import static org.junit.Assert.*;
  3. import org.junit.Test;
  4. import org.junit.runner.RunWith;
  5. import org.springframework.beans.factory.annotation.Autowired;
  6. import org.springframework.beans.factory.annotation.Qualifier;
  7. import org.springframework.test.context.ContextConfiguration;
  8. import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
  9. import com.alibaba.fastjson.JSON;
  10. import com.doctor.entity.Author;
  11. import com.doctor.enums.FavouriteSection;
  12. import com.doctor.manager.AuthorManager;
  13. @RunWith(SpringJUnit4ClassRunner.class)
  14. @ContextConfiguration(value = { "classpath:mybatisPracticeConfig/spring-context.xml" })
  15. public class AuthorManagerImplTest {
  16. @Autowired
  17. @Qualifier("authorManager")
  18. private AuthorManager authorManager;
  19. @Test
  20. public void testInsertAuthor() {
  21. Author author = new Author(null,"doctor","12367890","doctor@doctor.com","bio",FavouriteSection.VIDEOS);
  22. boolean b = authorManager.insertAuthor(author);
  23. assertTrue(b);
  24. assertNotNull(author.getId());
  25. }
  26. @Test
  27. public void testQueryById() {
  28. Author author = authorManager.queryById(10000L);
  29. System.out.println(JSON.toJSONString(author));
  30. }
  31. @Test
  32. public void testDeleteAuthorById() {
  33. fail("Not yet implemented");
  34. }
  35. }