lundi 2 novembre 2015

Create test for a small method with final classes, void method and exception

I am new with Test automation (Mockito, JUnit), and I do not get how I can test the following class. There are final classes, voids and Exception all together in the method and makes it pretty hard.

private final static String SERVER="http://testserver:9086";
private void checkServerr() throws myException {
    try {
        URL hp = new URL(SERVER);
        URLConnection hpCon = hp.openConnection();
        hpCon.connect();
    } catch (Exception e) {
        throw new myException("Server " + SERVER + " not available");
    }
}

Aucun commentaire:

Enregistrer un commentaire