package movierental;

import org.junit.jupiter.api.Test;

import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import static org.assertj.core.api.Assertions.assertThat;

public class CustomerTest {

    @Test
    public void test() {
        // Given
        Customer customer = new Customer("Bob");
        Movie mockMovie = mock(Movie.class);

        when(mockMovie.getTitle()).thenReturn("Mock Movie");
        when(mockMovie.getPriceCode()).thenReturn(Movie.REGULAR);
        customer.addRental(new Rental(mockMovie, 2));

        // When
        String statement = customer.statement();

        // Then
        String expected = "" +
                "Rental Record for Bob\n" +
                "\tMock Movie\t2.0\n" +
                "Amount owed is 2.0\n" +
                "You earned 1 frequent renter points";

        assertThat(statement).isEqualTo(expected);
    }
}