@@ -0,0 +1,1187 @@
+package org.jvalue.commons.utils;%0A%0A%0Aimport mockit.Mock;%0Aimport mockit.MockUp;%0Aimport mockit.Tested;%0Aimport mockit.integration.junit4.JMockit;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0A%0A@RunWith(JMockit.class)%0Apublic class HttpServiceCheckTest %7B%0A%0A%09@Tested%0A%09HttpServiceCheck mock;%0A%0A%09@Test%0A%09public void testCheckSuccess() %7B%0A%0A%09%09new MockUp%3CHttpServiceCheck%3E() %7B%0A%09%09%09@Mock%0A%09%09%09private boolean isReachable(String url) %7B%0A%09%09%09%09return true;%0A%09%09%09%7D%0A%09%09%7D;%0A%0A%09%09Assert.assertTrue(mock.check(%22http://example.com%22, 0, 1));%0A%09%7D%0A%0A%0A%09@Test%0A%09public void testCheckFailure() %7B%0A%0A%09%09new MockUp%3CHttpServiceCheck%3E() %7B%0A%09%09%09@Mock%0A%09%09%09private boolean isReachable(String url) %7B%0A%09%09%09%09return false;%0A%09%09%09%7D%0A%09%09%7D;%0A%0A%09%09Assert.assertFalse(mock.check(%22http://example.com%22, 0 , 1), %22Should fail%22);%0A%09%7D%0A%0A%0A%09@Test%0A%09public void testRetries() %7B%0A%0A%09%09new MockUp%3CHttpServiceCheck%3E() %7B%0A%09%09%09private int counter = 0;%0A%0A%09%09%09@Mock%0A%09%09%09private boolean isReachable(String url) %7B%0A%09%09%09%09counter++;%0A%09%09%09%09return counter %3E 3;%0A%09%09%09%7D%0A%09%09%7D;%0A%0A%09%09boolean resultFail = mock.check(%22http://example.com%22, 0, 1);%0A%09%09boolean resultSuccess = mock.check(%22http://example.com%22, 3, 1);%0A%0A%09%09Assert.assertFalse(resultFail, %22Should fail%22);%0A%09%09Assert.assertTrue(resultSuccess);%0A%09%7D%0A%7D%0A

Add tests for HttpServiceCheck