I was hoping that someone could tell me the best practice for the scenario I am running into with testing my code via junit4.
My pseudocode is as follows:
public class TestClass { private String readFromFile(String filePath) { use BufferedReader, get content file input append BufferedReader to StringBuffer return string } @Test public void testMethodOne() { String s = readFromFile(C:\fileOne); doStuff(s); } } The issue that I am having is that BufferedReader can throw an IOException. If the readFromFile() method is not a method in the test I am classing (I only need it for these test scenarios), do I annotate it with @Test (expected = IOException.class) anyway, or should I use a try-catch block?
Thank you very much!