其他分享
首页 > 其他分享> > 第十课笔记

第十课笔记

作者:互联网

目录

一、单元测试

二、打包四部曲

三、Linux部署

四、总结


一、单元测试

 

@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = ToutiaoApplication.class)
public class LikeServiceTests {
    @Autowired
    LikeService likeService;

    @Test
    public void testLike() {
        likeService.like(123, 1, 1);
        Assert.assertEquals(1, likeService.getLikeStatus(123, 1, 1));

        likeService.disLike(123, 1, 1);
        Assert.assertEquals(-1, likeService.getLikeStatus(123, 1, 1));
    }

    @Test
    public void testB() {
        System.out.println("B");
    }

    @Test(expected = IllegalArgumentException.class)
    public void testException() {
        throw new IllegalArgumentException("异常");
    }

    @Before
    public void setUp() {
        System.out.println("setUp");
    }

    @After
    public void tearDown() {
        System.out.println("tearDown");
    }

    @BeforeClass
    public static void beforeClass() {
        System.out.println("beforeClass");
    }

    @AfterClass
    public static void afterClass() {
        System.out.println("afterClass");
    }

}

二、打包四部曲

 

三、Linux部署

Nginx是一个具有负载均衡功能的Web Server

 

四、总结

 

 

标签:likeService,void,System,笔记,第十课,println,public,out
来源: https://blog.csdn.net/qq_35514456/article/details/119141611