+ 2

What will be the output of following test case?

Hi, I need to know the output of this negative test case which is written for Deserialize Employee class. @Test(expected = FileNotFoundException.class) public void TestCaseForDeserialize() throws ClassNotFoundException, IOException { serializer.deserialize("invalid name"); } Thanks in advance.

22nd Oct 2021, 12:46 PM
Dulya Perera
Dulya Perera - avatar
2 Réponses
+ 1
I found the answer. This test case will pass without any error. Because it's expected a exception of FileNotFoundException. If the actual exception is FileNotFoundException this test case will pass. If the actual exception is other than that(FileNotFoundException) this test case will fail. If there any wrong point in my answer please correct me😊.
22nd Oct 2021, 3:53 PM
Dulya Perera
Dulya Perera - avatar
0
however, we don't know what .deserialize() really throws
22nd Oct 2021, 9:52 PM
zemiak