1010import sc .server .network .MockClient ;
1111import sc .server .network .PacketCallback ;
1212import sc .server .plugins .TestPlugin ;
13- import sc .shared .InvalidGameStateException ;
14-
15- import java .io .IOException ;
1613
1714public class AdministratorTest extends AbstractRoleTest {
1815 private static final String CORRECT_PASSWORD = "this-is-a-secret" ;
1916 private static final String WRONG_PASSWORD = "i-am-a-hacker" ;
2017
2118 @ Test
22- public void shouldBecomeAdminWithCorrectPassword () throws IOException ,
23- RescuableClientException , InvalidGameStateException {
19+ public void shouldBecomeAdminWithCorrectPassword () {
2420 Client client = connectAsAdmin ();
2521
2622 Assert .assertEquals (1 , client .getRoles ().size ());
2723 Assert .assertEquals (true , client .isAdministrator ());
2824 }
2925
3026 @ Test
31- public void shouldNotBecomeAdminWithWrongPassword () throws IOException , InvalidGameStateException {
27+ public void shouldNotBecomeAdminWithWrongPassword () {
3228 Client client = connectClient ();
3329
3430 Configuration .set (Configuration .PASSWORD_KEY , CORRECT_PASSWORD );
3531
3632 try {
37- this .lobby .onRequest (client , new PacketCallback (new AuthenticateRequest (
38- WRONG_PASSWORD )));
33+ this .lobby .onRequest (client , new PacketCallback (new AuthenticateRequest (WRONG_PASSWORD )));
3934 Assert .fail ("No exception was thrown" );
4035 } catch (RescuableClientException e ) {
4136 // expected
@@ -45,15 +40,14 @@ public void shouldNotBecomeAdminWithWrongPassword() throws IOException, InvalidG
4540 Assert .assertEquals (false , client .isAdministrator ());
4641 }
4742
48- protected MockClient connectAsAdmin () throws InvalidGameStateException {
43+ protected MockClient connectAsAdmin () {
4944 MockClient client = null ;
5045 client = connectClient ();
5146
5247 Configuration .set (Configuration .PASSWORD_KEY , CORRECT_PASSWORD );
5348
5449 try {
55- this .lobby .onRequest (client , new PacketCallback (new AuthenticateRequest (
56- CORRECT_PASSWORD )));
50+ this .lobby .onRequest (client , new PacketCallback (new AuthenticateRequest (CORRECT_PASSWORD )));
5751 } catch (RescuableClientException e ) {
5852 Assert .fail ("Could not authenticate as admin." );
5953 }
@@ -62,12 +56,9 @@ protected MockClient connectAsAdmin() throws InvalidGameStateException {
6256 }
6357
6458 @ Test
65- public void shouldBeAbleToPrepareGame () throws RescuableClientException , InvalidGameStateException {
59+ public void shouldBeAbleToPrepareGame () throws RescuableClientException {
6660 Client client = connectAsAdmin ();
67-
68- this .lobby .onRequest (client , new PacketCallback (new PrepareGameRequest (
69- TestPlugin .TEST_PLUGIN_UUID )));
70-
61+ this .lobby .onRequest (client , new PacketCallback (new PrepareGameRequest (TestPlugin .TEST_PLUGIN_UUID )));
7162 Assert .assertEquals (1 , this .gameMgr .getGames ().size ());
7263 }
7364
0 commit comments