package com.akikanellis.kata01.offer;

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

import static com.akikanellis.kata01.test_utils.Fakes.createDefaultOfferStrategy;
import static com.akikanellis.kata01.test_utils.Fakes.createOfferStrategyWithId;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;

public class InMemoryOfferStrategyRepositoryTest {
    private InMemoryOfferStrategyRepository offerStrategies;

    @Before public void beforeEach() { offerStrategies = new InMemoryOfferStrategyRepository(); }

    @Test public void addingStrategy_withNoExistingStrategy_addsToStrategies() {
        OfferStrategy offerStrategy = createDefaultOfferStrategy();

        offerStrategies.add(offerStrategy);

        assertThat(offerStrategies.contains(offerStrategy)).isTrue();
    }

    @Test public void addingStrategy_withExistingStrategy_replacesStrategy() {
        OfferStrategy offerStrategy = createDefaultOfferStrategy();
        offerStrategies.add(offerStrategy);

        offerStrategies.add(offerStrategy);

        assertThat(offerStrategies.getAll().asSet()).containsOnly(offerStrategy);
    }

    @Test public void removingStrategy_removesFromStrategies() {
        OfferStrategy offerStrategy = createDefaultOfferStrategy();
        offerStrategies.add(offerStrategy);

        offerStrategies.remove(offerStrategy);

        assertThat(offerStrategies.getAll().isEmpty()).isTrue();
    }

    @Test public void gettingById_withExistingStrategy_returnsStrategy() {
        long id = 11;
        OfferStrategy expectedOfferStrategy = createOfferStrategyWithId(id);
        offerStrategies.add(expectedOfferStrategy);

        OfferStrategy actualOfferStrategy = offerStrategies.getById(id);

        assertThat(actualOfferStrategy).isEqualTo(expectedOfferStrategy);
    }

    @Test public void gettingById_withNoExistingStrategy_throwsException() {
        assertThatExceptionOfType(OfferStrategyDoesNotExistException.class)
                .isThrownBy(() -> offerStrategies.getById(11));
    }
}
@@ -1225,16 +1225,37 @@
 trategy_
+withExistingStrategy_
 removesF
@@ -1497,32 +1497,299 @@
 sTrue();%0A    %7D%0A%0A
+    @Test public void removingStrategy_withNoExistingStrategy_doesNothing() %7B%0A        OfferStrategy offerStrategy = createDefaultOfferStrategy();%0A%0A        offerStrategies.remove(offerStrategy);%0A%0A        assertThat(offerStrategies.getAll().isEmpty()).isTrue();%0A    %7D%0A%0A
     @Test public

Improve strategy repository tests