package com.avg.zaap.crashlibrary.publish.cap.http;

import org.junit.Before;
import org.junit.Test;

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

/**
 * A test class for {@link CapResponse}.
 * <p>
 * Created by marek.osvald on 9.6.2016.
 */
public class CapResponseTests {

    private static final int HTTP_CODE = 200;
    private static final String HTTP_MESSAGE = "httpMessage";
    private static final int CAP_CODE = 1;
    private static final String CAP_MESSAGE = "capMessage";

    private CapResponse mCapResponse;

    @Before
    public void setUp() throws Exception {
        mCapResponse = new CapResponse(HTTP_CODE, HTTP_MESSAGE, CAP_CODE, CAP_MESSAGE);
    }

    @Test
    public void toString_nothing_returnsString() throws Exception {
        // act
        String string = mCapResponse.toString();

        // assert
        assertThat(string, is(String.format("{ HTTP code: %d, HTTP message: %s, CAP code: %d, CAP message: %s }", HTTP_CODE, HTTP_MESSAGE, CAP_CODE, CAP_MESSAGE)));
    }

}
