View Javadoc
1   package civitas.common.encryptedchoice;
2   
3   import static org.mockito.ArgumentMatchers.any;
4   import static org.mockito.ArgumentMatchers.eq;
5   import static org.mockito.Mockito.mock;
6   import static org.mockito.Mockito.when;
7   
8   import civitas.common.ballot.BallotTestData;
9   import civitas.crypto.oneoflreencryption.ElGamal1OfLReencryptionTestData;
10  
11  public class EncryptChoiceStub implements BallotTestData, ElGamal1OfLReencryptionTestData {
12  
13  	public static EncryptChoice stub() {
14  		EncryptChoice mock = mock(EncryptChoice.class);
15  		for (Integer piece : VOTE_PIECES) {
16  			when(mock.apply(any(), any(), any(), eq(piece)))
17  					.thenReturn(new EncryptedChoice(
18  							ELGAMAL_REENCRYPT_FACTOR_EPRIME,
19  							EL_GAMAL_1_OF_L_REENCRYPTION_MAP.get(BALLOT.matrix[piece])));
20  		}
21  		return mock;
22  	}
23  }