public counterPublisher() {
try {
ObjectPublisher objPub = new ObjectPublisher.build().port(55).build();
}
catch(SocketException || UnknownHostException) {
Logger.record(“...”);
}
@Test(expected = SocketExcetion)
public void testConst() Throws Exception {
doThrow(new SocketException()).when(ObjectPublisher).build();
counterPublisher cp = new counterPublisher();
// don’t know how to cover this, so I can reach 90% coverage
// I’m getting branch coverage ratio 0 in jacoco
// could not find an answer online.
To add a context: i tried everything I found online but they didn’t work for this issue. I would appreciate any help