@@ -0,0 +1,2741 @@
+package com.blundell.quicksand;%0A%0Aimport com.blundell.quicksand.viscosity.Viscosity;%0A%0Aimport java.util.Collections;%0Aimport java.util.HashMap;%0Aimport java.util.Map;%0A%0Aimport org.junit.Test;%0A%0Aimport static org.fest.assertions.api.Assertions.assertThat;%0A%0Apublic class ViscosityCollectionTest %7B%0A%0A    @Test%0A    public void givenAKnownViscosityWhenWeRetrieveItByTheCorrectKeyThenTheCorrectViscosityIsReturned() throws Exception %7B%0A        Map%3CString, Viscosity%3E viscosities = new HashMap%3C%3E();%0A        String key = %22TestKey%22;%0A        StubViscosity expectedViscosity = new StubViscosity();%0A        viscosities.put(key, expectedViscosity);%0A        ViscosityCollection collection = new ViscosityCollection(viscosities, new StubViscosity());%0A%0A        Viscosity actualViscosity = collection.getFor(key);%0A%0A        assertThat(actualViscosity).isEqualTo(expectedViscosity);%0A    %7D%0A%0A    @Test%0A    public void givenAKnownViscosityWhenWeRetrieveItByAnIncorrectKeyThenTheCorrectViscosityIsNotReturned() throws Exception %7B%0A        Map%3CString, Viscosity%3E viscosities = new HashMap%3C%3E();%0A        StubViscosity expectedViscosity = new StubViscosity();%0A        viscosities.put(%22TestKey%22, expectedViscosity);%0A        ViscosityCollection collection = new ViscosityCollection(viscosities, new StubViscosity());%0A%0A        Viscosity actualViscosity = collection.getFor(%22WrongTestKey%22);%0A%0A        assertThat(actualViscosity).isNotEqualTo(expectedViscosity);%0A    %7D%0A%0A    @Test%0A    public void givenAKnownViscosityWhenWeRetrieveItByAnIncorrectKeyThenTheDefaultViscosityIsReturned() throws Exception %7B%0A        Map%3CString, Viscosity%3E viscosities = new HashMap%3C%3E();%0A        StubViscosity expectedViscosity = new StubViscosity();%0A        viscosities.put(%22TestKey%22, expectedViscosity);%0A        StubViscosity defaultViscosity = new StubViscosity();%0A        ViscosityCollection collection = new ViscosityCollection(viscosities, defaultViscosity);%0A%0A        Viscosity actualViscosity = collection.getFor(%22WrongTestKey%22);%0A%0A        assertThat(actualViscosity).isEqualTo(defaultViscosity);%0A    %7D%0A%0A    @Test%0A    public void givenAnEmptyCollectionWhenWeRetrieveByAnyKeyThenTheDefaultViscosityIsReturned() throws Exception %7B%0A        Map%3CString, Viscosity%3E viscosities = Collections.emptyMap();%0A        StubViscosity defaultViscosity = new StubViscosity();%0A        ViscosityCollection collection = new ViscosityCollection(viscosities, defaultViscosity);%0A%0A        Viscosity actualViscosity = collection.getFor(%22AnyTestKey%22);%0A%0A        assertThat(actualViscosity).isEqualTo(defaultViscosity);%0A    %7D%0A%0A    private static class StubViscosity implements Viscosity %7B%0A%0A        @Override%0A        public long calculateDuration(long currentDuration, long viewCount) %7B%0A            return 0;%0A        %7D%0A%0A    %7D%0A%7D%0A

Add collection tests