/**
 *
 * Copyright (c) 2006-2017, Speedment, Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); You may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at:
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package com.speedment.tool.core.internal.component;

import com.speedment.generator.core.GeneratorBundle;
import com.speedment.runtime.core.ApplicationBuilder;
import com.speedment.runtime.core.Speedment;
import com.speedment.tool.core.ToolBundle;
import com.speedment.tool.core.component.VersionComponent;
import org.junit.Test;

import java.net.UnknownHostException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;

/**
 *
 * @author  Emil Forslund
 * @since   3.0.0
 */
public class VersionComponentImplTest {

    /**
     * Test of latestVersion method, of class VersionComponentImpl.
     */
    @Test
    public void testLatestVersion() {
        System.out.println("Determining the latest version of Speedment.");
        final Speedment speedment = ApplicationBuilder.empty()
            .withBundle(GeneratorBundle.class)
            .withBundle(ToolBundle.class)
            .withSkipCheckDatabaseConnectivity()
            .withSkipValidateRuntimeConfig()
            .build();
        
        final VersionComponent version = speedment.getOrThrow(VersionComponent.class);
        
        try {
            final String latest = version.latestVersion().get(2, TimeUnit.SECONDS);
            System.out.println("The latest released version of Speedment is " + latest + ".");
        } catch (final ExecutionException | InterruptedException ex) {
            if (hasCause(ex, UnknownHostException.class)) {
                System.out.println("UnknownHostException - not connected to the Internet?");
            } else {
                throw new RuntimeException(ex);
            }
        } catch (final TimeoutException ex ) {
            System.out.println("Connection timed out before a version could be established");
        }
    }

    private static boolean hasCause(Exception ex, Class<? extends Throwable> c) {
        Throwable cause = ex.getCause();
        while (cause != null) {
            if (c.equals(cause.getClass())) {
                return true;
            }
            cause = cause.getCause();
        }
        return false;
    }

}

@@ -673,24 +673,117 @@
 component;%0A%0A
+import com.speedment.common.logger.Logger;%0Aimport com.speedment.common.logger.LoggerManager;%0A
 import com.s
@@ -1028,32 +1028,8 @@
 nt;%0A
-import org.junit.Test;%0A%0A
 impo
@@ -1198,104 +1198,337 @@
 on;%0A
-%0A/**%0A *%0A * @author  Emil Forslund%0A * @since   3.0.0%0A */%0Apublic class VersionComponentImplTest %7B%0A
+import org.junit.Test;%0A%0A/**%0A * Tests the default %7B@link VersionComponent%7D to make sure it can query the%0A * public GitHub API.%0A * %0A * @author  Emil Forslund%0A * @since   3.0.0%0A */%0Apublic class VersionComponentImplTest %7B%0A%0A    private final static Logger LOGGER =%0A        LoggerManager.getLogger(VersionComponentImplTest.class);%0A    
 %0A   
@@ -1664,34 +1664,27 @@
         
-System.out.println
+LOGGER.info
 (%22Determ
@@ -2208,34 +2208,27 @@
         
-System.out.println
+LOGGER.info
 (%22The la
@@ -2435,52 +2435,26 @@
     
-System.out.println(%22UnknownHostException - n
+LOGGER.warn(ex, %22N
 ot c
@@ -2523,34 +2523,20 @@
     
-throw new RuntimeException
+LOGGER.error
 (ex)
@@ -2614,27 +2614,25 @@
     
-System.out.println(
+LOGGER.error(ex, 
 %22Con
@@ -2686,16 +2686,17 @@
 ablished
+.
 %22);%0A    
@@ -2823,32 +2823,41 @@
  ex.getCause();%0A
+        %0A
         while (c
@@ -3001,32 +3001,41 @@
 se();%0A        %7D%0A
+        %0A
         return f
@@ -3046,11 +3046,10 @@
 ;%0A    %7D%0A
-%0A
 %7D%0A

Fix #348 by only warning when exception is encountered