package com.avg.zaap.crashlibrary.offline;

import org.junit.Test;

import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;

/**
 * A test class for {@link Connection}.
 * <p/>
 * Created by marek.osvald on 1.9.2016.
 */
public class ConnectionTests {

    private static final int LEVEL_NONE = 0;
    private static final int LEVEL_OTHER = 1;
    private static final int LEVEL_MOBILE = 2;
    private static final int LEVEL_WIFI = 3;

    private Connection mConnection;

    @Test
    public void getLevel_none_returnsLevelNone() throws Exception {
        // arrange
        mConnection = Connection.NONE;

        // act
        final int level = mConnection.getLevel();

        // assert
        assertThat(level, is(LEVEL_NONE));
    }

    @Test
    public void getLevel_other_returnsLevelOther() throws Exception {
        // arrange
        mConnection = Connection.OTHER;

        // act
        final int level = mConnection.getLevel();

        // assert
        assertThat(level, is(LEVEL_OTHER));
    }

    @Test
    public void getLevel_wifi_returnsLevelWifi() throws Exception {
        // arrange
        mConnection = Connection.WIFI;

        // act
        final int level = mConnection.getLevel();

        // assert
        assertThat(level, is(LEVEL_WIFI));
    }

    @Test
    public void getLevel_mobile_returnsLevelMobile() throws Exception {
        // arrange
        mConnection = Connection.MOBILE;

        // act
        final int level = mConnection.getLevel();

        // assert
        assertThat(level, is(LEVEL_MOBILE));
    }

}