FactoryDecoratorTest
This commit is contained in:
		
							parent
							
								
									186c389bd2
								
							
						
					
					
						commit
						2a8caf8efd
					
				| 
						 | 
					@ -0,0 +1,38 @@
 | 
				
			||||||
 | 
					package ch.zhaw.projekt2.turnierverwaltung;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import javafx.scene.layout.BorderPane;
 | 
				
			||||||
 | 
					import javafx.scene.layout.Pane;
 | 
				
			||||||
 | 
					import org.junit.jupiter.api.Test;
 | 
				
			||||||
 | 
					import org.mockito.InOrder;
 | 
				
			||||||
 | 
					import org.mockito.Mockito;
 | 
				
			||||||
 | 
					import java.io.IOException;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import static org.junit.jupiter.api.Assertions.fail;
 | 
				
			||||||
 | 
					import static org.mockito.Mockito.inOrder;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class FactoryDecoratorTest {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private FactoryDecorator factoryDecorator;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Test
 | 
				
			||||||
 | 
					    void test() {
 | 
				
			||||||
 | 
					        FileIO io = Mockito.mock(FileIO.class);
 | 
				
			||||||
 | 
					        Factory fc = Mockito.mock(Factory.class);
 | 
				
			||||||
 | 
					        Pane pn = Mockito.mock(BorderPane.class);
 | 
				
			||||||
 | 
					        FileIO.TournamentFile tf = Mockito.mock(FileIO.TournamentFile.class);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        factoryDecorator = new FactoryDecorator(io,fc,pn);
 | 
				
			||||||
 | 
					        factoryDecorator.openTournament(tf);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        InOrder order = inOrder(io,fc,pn);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        try {
 | 
				
			||||||
 | 
					            order.verify(fc).setTournament(io.loadTournament(tf));
 | 
				
			||||||
 | 
					            order.verify(fc).showGameScheduler((BorderPane) pn);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        } catch (IOException | ClassNotFoundException e) {
 | 
				
			||||||
 | 
					            e.printStackTrace();
 | 
				
			||||||
 | 
					            fail();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -1,27 +0,0 @@
 | 
				
			||||||
package ch.zhaw.projekt2.turnierverwaltung;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import javafx.scene.layout.BorderPane;
 | 
					 | 
				
			||||||
import org.junit.jupiter.api.DisplayName;
 | 
					 | 
				
			||||||
import org.junit.jupiter.api.Test;
 | 
					 | 
				
			||||||
import org.mockito.InOrder;
 | 
					 | 
				
			||||||
import org.mockito.Mockito;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import static org.mockito.Mockito.inOrder;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public class FactoryTest {
 | 
					 | 
				
			||||||
    private Factory factory;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Test
 | 
					 | 
				
			||||||
    @DisplayName("Test method calls")
 | 
					 | 
				
			||||||
    void checkMethodCalls() {
 | 
					 | 
				
			||||||
        FileIO fileIO = Mockito.mock(FileIO.class);
 | 
					 | 
				
			||||||
        TournamentDecorator td = Mockito.mock(TournamentDecorator.class);
 | 
					 | 
				
			||||||
        LanguageConfigurator lc = Mockito.mock(LanguageConfigurator.class);
 | 
					 | 
				
			||||||
        BorderPane pane = Mockito.mock(BorderPane.class);
 | 
					 | 
				
			||||||
        factory = new Factory(fileIO,td,lc);
 | 
					 | 
				
			||||||
        InOrder order = inOrder(fileIO,td,lc);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        //factory.showTournamentList(pane);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
		Loading…
	
		Reference in New Issue