Last active
August 29, 2015 14:25
-
-
Save PanAeon/e79dec93a9020d5cefdd to your computer and use it in GitHub Desktop.
LocationManagerTest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package goit.vh.kickstarter.mvc.model; | |
import goit.vh.kickstarter.DataRegistry; | |
import goit.vh.kickstarter.Output; | |
import goit.vh.kickstarter.mvc.controller.CategoryController; | |
import junit.framework.TestCase; | |
import org.junit.Assert; | |
import org.junit.Before; | |
import org.junit.Test; | |
import org.mockito.Mock; | |
import org.mockito.MockitoAnnotations; | |
import java.util.ArrayList; | |
import java.util.HashMap; | |
import java.util.List; | |
import java.util.Map; | |
import static org.mockito.Mockito.*; | |
/** | |
* Created by Viktor on 26.07.2015. | |
*/ | |
public class CategoryModelTest { | |
// @Mock | |
// private DataRegistry dataRegistry; | |
@Mock | |
private Output output = new Output(); | |
@Mock | |
private Map<Integer, ArrayList<ProjectModel>> categories; | |
@Before | |
public void setUp(){ | |
MockitoAnnotations.initMocks(this); | |
} | |
@Test() | |
public void whenRefreshShouldReturn0() throws Exception { | |
CategoryModel categoryModel = new CategoryModel(); | |
DataRegistry dataRegistry = new DataRegistry(); | |
dataRegistry.registerCategories(categories); | |
categoryModel.setDataRegistry(dataRegistry); | |
when(categories.size()).thenReturn(2); | |
Assert.assertEquals("Should return null", null, categoryModel.refreshModel(5)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment