@Test public void rootUserCannotRemoveSocialNetworkConnection() { RootUser user = this.generateRootUser().findRootUser(null); user.addSocialNetworkConnection(mockedValidNetworkConnection); user.getSocialNetworkConnections().clear(); assertTrue(user.getSocialNetworkConnections().size() > 0); }
@Test public void rootUserAddSocialNetworkGeneratesEvent() { RootUser user = this.generateRootUser().findRootUser(null); UserConnectedToNetworkEvent event = user.addSocialNetworkConnection(mockedValidNetworkConnection); assertEquals(mockedValidNetworkConnection, event.getSocialNetworkConnection()); assertEquals(user.getUserIdentity(), event.getUserIdentity()); }
@Test public void rootUserCanHaveValidSocialNetworkConnection() { RootUser user = this.generateRootUser().findRootUser(null); assertNotNull(user.addSocialNetworkConnection(mockedValidNetworkConnection)); assertNotNull(user.getConnection(SocialNetwork.STUB).getSocialNetwork()); // we should be able to override this; SocialNetworkConnection stubConnection = mockedValidNetworkConnection; stubConnection.addToken(SocialNetworkToken.TOKEN, "testvalue"); user.addSocialNetworkConnection(stubConnection); assertTrue( user.getConnection(stubConnection.getSocialNetwork()) .getTokens() .equals(stubConnection.getTokens())); }