1010import static org .mockito .Mockito .doAnswer ;
1111import static org .mockito .Mockito .mock ;
1212import static org .mockito .Mockito .never ;
13- import static org .mockito .Mockito .spy ;
1413import static org .mockito .Mockito .verify ;
1514import static org .mockito .Mockito .when ;
1615
1918
2019import org .junit .Before ;
2120import org .junit .Test ;
22- import org .mockito .Mockito ;
2321import org .mockito .invocation .InvocationOnMock ;
2422import org .mockito .stubbing .Answer ;
2523import org .slf4j .Logger ;
2624import org .slf4j .LoggerFactory ;
2725
2826import de .doubleslash .keeptime .controller .Controller ;
29- import de .doubleslash .keeptime .model .Model ;
3027import de .doubleslash .keeptime .model .Project ;
31- import de .doubleslash .keeptime .model .repos .ProjectRepository ;
32- import de .doubleslash .keeptime .model .repos .SettingsRepository ;
33- import de .doubleslash .keeptime .model .repos .WorkRepository ;
3428import javafx .collections .FXCollections ;
3529import javafx .collections .ObservableList ;
3630import javafx .scene .paint .Color ;
@@ -47,16 +41,10 @@ public class ConfigParserTest {
4741 private final Project hinzUndKunz = new Project ("Hinz und Kunz" , Color .DARKRED , true , 3 );
4842 private final ObservableList <Project > projects = FXCollections .observableArrayList ();
4943
50- private Model model ;
51- private ObservableList <Project > spyModel ;
5244 private final Controller controller = mock (Controller .class );
5345
5446 @ Before
5547 public void beforeTest () {
56- model = new Model (Mockito .mock (ProjectRepository .class ), Mockito .mock (WorkRepository .class ),
57- Mockito .mock (SettingsRepository .class ));
58- spyModel = spy (model .availableProjects );
59-
6048 projects .add (idle );
6149 projects .add (heinz );
6250 projects .add (peter );
@@ -66,7 +54,6 @@ public void beforeTest() {
6654 @ Test
6755 public void testImportFromFileOnce () {
6856 when (controller .getAvailableProjects ()).thenReturn (projects );
69- when (spyModel .size ()).thenReturn (4 );
7057 doAnswer (new Answer () {
7158 @ Override
7259 public Object answer (final InvocationOnMock invocation ) {
@@ -88,15 +75,14 @@ public Object answer(final InvocationOnMock invocation) {
8875 }
8976
9077 private void loadConfigFile (final String configFile ) {
91- final ConfigParser testSubject = new ConfigParser (model , controller );
78+ final ConfigParser testSubject = new ConfigParser (controller );
9279 final File inputfile = new File (configFile );
93- testSubject .parserConfig (inputfile );
80+ testSubject .parseConfig (inputfile );
9481 }
9582
9683 @ Test
9784 public void testDoNotImportIdle () {
9885 when (controller .getAvailableProjects ()).thenReturn (projects );
99- when (spyModel .size ()).thenReturn (4 );
10086 doAnswer (new Answer () {
10187 @ Override
10288 public Object answer (final InvocationOnMock invocation ) {
@@ -117,7 +103,6 @@ public Object answer(final InvocationOnMock invocation) {
117103 @ Test
118104 public void testImportNonexistingProjects () {
119105 when (controller .getAvailableProjects ()).thenReturn (projects );
120- when (spyModel .size ()).thenReturn (4 );
121106 doAnswer (new Answer () {
122107 @ Override
123108 public Object answer (final InvocationOnMock invocation ) {
@@ -138,7 +123,6 @@ public Object answer(final InvocationOnMock invocation) {
138123 @ Test
139124 public void testIndexIsRight () {
140125 when (controller .getAvailableProjects ()).thenReturn (projects );
141- when (spyModel .size ()).thenReturn (4 );
142126 doAnswer (new Answer () {
143127 @ Override
144128 public Object answer (final InvocationOnMock invocation ) {
@@ -159,7 +143,6 @@ public Object answer(final InvocationOnMock invocation) {
159143 @ Test
160144 public void testProject1IsParsedCorrectly () {
161145 when (controller .getAvailableProjects ()).thenReturn (projects );
162- when (spyModel .size ()).thenReturn (4 );
163146 doAnswer (new Answer () {
164147 @ Override
165148 public Object answer (final InvocationOnMock invocation ) {
@@ -179,7 +162,6 @@ public Object answer(final InvocationOnMock invocation) {
179162 @ Test
180163 public void testProject2IsParsedCorrectly () {
181164 when (controller .getAvailableProjects ()).thenReturn (projects );
182- when (spyModel .size ()).thenReturn (4 );
183165 doAnswer (new Answer () {
184166 @ Override
185167 public Object answer (final InvocationOnMock invocation ) {
0 commit comments