package com.atlassian.bitbucket.mesh.git.transcode;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;

import java.util.concurrent.ExecutorService;

import static org.junit.Assert.assertFalse;

@RunWith(MockitoJUnitRunner.Silent.class)
public class DefaultTranscodeServerTest {

    @Mock
    private ExecutorService executorService;
    private DefaultTranscodeServer server;
    @Mock
    private Transcoder transcoder;

    @Before
    public void setup() {
        server = new DefaultTranscodeServer(executorService, transcoder, null, 0);
    }

    @Test(expected = IllegalStateException.class)
    public void testGetAddressThrowsWhenNotRunning() {
        assertFalse(server.isRunning());

        server.getAddress();
    }

    @Test(expected = IllegalStateException.class)
    public void testGetPortThrowsWhenNotRunning() {
        assertFalse(server.isRunning());

        server.getPort();
    }
}