11package it .polimi .ingsw .controller ;
22
33import it .polimi .ingsw .client .messages .actions .ChallengerPhaseAction ;
4+ import it .polimi .ingsw .client .messages .actions .UserAction ;
45import it .polimi .ingsw .client .messages .actions .WorkerSetupMessage ;
56import it .polimi .ingsw .client .messages .actions .turnactions .EndTurnAction ;
67import it .polimi .ingsw .client .messages .actions .workeractions .MoveAction ;
3132class ControllerTest {
3233 controllerStub controller ;
3334 Game game ;
35+ UserAction new0 ;
36+ UserAction new1 ;
37+ UserAction new2 ;
38+ UserAction new3 ;
3439
3540 private class PlayerStub extends Player {
3641 private final List <Worker > workers = new ArrayList <>();
@@ -118,6 +123,10 @@ void initialization() {
118123 game .getActivePlayers ().get (1 ).addWorker (Card .ATLAS , new VirtualClient ());
119124 game .setCurrentPlayer (game .getActivePlayers ().get (0 ));
120125 controller = new controllerStub (game , new GameHandlerStub (new Server ()));
126+ new0 = new ChallengerPhaseAction ("GODLIST" );
127+ new1 = new WorkerSetupMessage (new String []{null , "1" , "2" , "3" , "4" });
128+ new2 = new EndTurnAction ();
129+ new3 = null ;
121130 }
122131
123132 @ DisplayName ("Worker placement test in standard condition, with no errors expected" )
@@ -167,15 +176,21 @@ void workerPlacementOccupiedCoords() {
167176 @ DisplayName ("God Selection Controller setting check" )
168177 @ Test
169178 void godSelectionSetting () {
170- controller .setSelectionController (1 );
179+ int i =1 ;
180+ assertEquals (1 , i );
181+ controller .setSelectionController (i );
171182 }
172183
173184 @ DisplayName ("Listener's firing test" )
174185 @ Test
175186 void listenerTest () {
176- controller .propertyChange (new PropertyChangeEvent (this , "godSelection" , null , new ChallengerPhaseAction ("GODLIST" )));
177- controller .propertyChange (new PropertyChangeEvent (this , "workerPlacement" , null , new WorkerSetupMessage (new String []{null , "1" , "2" , "3" , "4" })));
178- controller .propertyChange (new PropertyChangeEvent (this , "turnController" , null , new EndTurnAction ()));
179- controller .propertyChange (new PropertyChangeEvent (this , "nonSensePhrase" , null , null ));
187+ assert (new0 instanceof ChallengerPhaseAction );
188+ assert (new1 instanceof WorkerSetupMessage );
189+ assert (new2 instanceof EndTurnAction );
190+ assertEquals (null , new3 );
191+ controller .propertyChange (new PropertyChangeEvent (this , "godSelection" ,null , new0 ));
192+ controller .propertyChange (new PropertyChangeEvent (this , "workerPlacement" , null , new1 ));
193+ controller .propertyChange (new PropertyChangeEvent (this , "turnController" , null , new2 ));
194+ controller .propertyChange (new PropertyChangeEvent (this , "nonSensePhrase" , null , new3 ));
180195 }
181196}
0 commit comments