웹/Spring

@Test(expected=class) junit5에서 사용법

컴퓨터과학 2022. 8. 10. 23:34

junit4

@Test(expected=dataNotFoundClass)
public void notExisted()
{
    dataService.getdata(키값)
}

junit 5

 @Test
public void notExisted()
{
      assertThrows(dataNotFoundClass.class,()->dataService.getdata(키값));
}

 

음 뭔가 junit5 직관적이진 않네요 ㅎ