@@ -0,0 +1,2476 @@
+package alexandria.israelferrer.com.libraryofalexandria;%0A%0Aimport android.content.SharedPreferences;%0A%0Aimport junit.framework.TestCase;%0A%0Aimport org.mockito.invocation.InvocationOnMock;%0Aimport org.mockito.stubbing.Answer;%0A%0Aimport static alexandria.israelferrer.com.libraryofalexandria.ArtWorkListActivityTests.ARTWORKS;%0Aimport static org.mockito.Matchers.any;%0Aimport static org.mockito.Mockito.doAnswer;%0Aimport static org.mockito.Mockito.eq;%0Aimport static org.mockito.Mockito.mock;%0Aimport static org.mockito.Mockito.only;%0Aimport static org.mockito.Mockito.times;%0Aimport static org.mockito.Mockito.verify;%0A%0Apublic class ArtWorkModelTests extends TestCase %7B%0A    private ArtWorkModel model;%0A    private SharedPreferences preferences;%0A    private ArtWorkService service;%0A    private Callback callback;%0A    private Exception exception;%0A%0A    @Override%0A    public void setUp() throws Exception %7B%0A        super.setUp();%0A%0A        preferences = mock(SharedPreferences.class);%0A        service = mock(ArtWorkService.class);%0A        callback = mock(Callback.class);%0A        model = new ArtWorkModel(service, preferences);%0A        exception = new Exception();%0A    %7D%0A%0A    public void testGetArtWorks_success() throws Exception %7B%0A        serviceSuccessAnswer();%0A        model.getArtWorks(callback);%0A        verify(service, only()).getArtWorks(any(Callback.class));%0A        verify(callback, only()).success(ARTWORKS);%0A        verify(preferences, times(ARTWORKS.size())).getFloat(any(String.class), eq(0F));%0A    %7D%0A%0A    private void serviceSuccessAnswer() %7B%0A        doAnswer(new Answer() %7B%0A            public Object answer(InvocationOnMock invocation) %7B%0A                Object%5B%5D args = invocation.getArguments();%0A                ((Callback) args%5B0%5D).success(ARTWORKS);%0A                return null;%0A            %7D%0A        %7D).when(service).getArtWorks(any(Callback.class));%0A    %7D%0A%0A    public void testGetArtWorks_failure() throws Exception %7B%0A        serviceFailureAnswer();%0A        model.getArtWorks(callback);%0A        verify(service, only()).getArtWorks(any(Callback.class));%0A        verify(callback, only()).failure(exception);%0A    %7D%0A%0A    private void serviceFailureAnswer() %7B%0A        doAnswer(new Answer() %7B%0A            public Object answer(InvocationOnMock invocation) %7B%0A                Object%5B%5D args = invocation.getArguments();%0A                ((Callback) args%5B0%5D).failure(exception);%0A                return null;%0A            %7D%0A        %7D).when(service).getArtWorks(any(Callback.class));%0A    %7D%0A%7D%0A

Add test to the model