package com.darkmouglass.bicycle;

import com.darkmouglass.data.DarkMouglassData;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.boot.test.WebIntegrationTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.web.client.RestTemplate;

import static org.assertj.core.api.Assertions.assertThat;


@WebIntegrationTest(randomPort = true)
@SpringApplicationConfiguration(classes = DarkMouglassData.class)
@ActiveProfiles("test")
@RunWith(SpringJUnit4ClassRunner.class)
public class Bicycle {

    @Value("${local.server.port}")
    int port;

    private final RestTemplate restTemplate = new RestTemplate();;
    private String host;

    @Before
    public void setup() {
        host = String.format("http://localhost:%d", port);
    }

    @Test
    public void serverExists() {
        assert(true);
//        assertThat(restTemplate.getForEntity(host, String.class).getStatusCode()).isEqualTo(200);
    }


}
