I am trying improve line coverage for my code. A line gets executed where i am calling a method which in turn will throw an exception. But line coverage shows red color meaning the line was not executed.
Code:
1 public void myMethod(SomeService someService){
2 throwException(someService);
3 }
4 public void throwException(SomeService someService){
5 THROW an exception here
6 }
In my test class I am preparing SomeService required data and calling myMethod from above code. line # 2 shows red color even though the line gets executed and throws exception as expected. Please suggest how can i show the line covered to increase the line coverage.