Guest User

Untitled

a guest
Jul 18th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. import org.bouncycastle.cms.SignerInformation;
  2.  
  3. public class SignerInformationConsumer {
  4. public String interact(SignerInformation si) {
  5. return si.getDigestAlgOID();
  6. }
  7. }
  8.  
  9. import org.bouncycastle.cms.SignerInformation
  10. import spock.lang.Shared
  11. import spock.lang.Specification
  12.  
  13. class SignerInformationConsumerTest extends Specification {
  14.  
  15. @Shared
  16. SignerInformation si = Mock()
  17.  
  18. def "should return valid array"() {
  19. given:
  20. SignerInformationConsumer test = new SignerInformationConsumer()
  21. si.digestAlgOID >> "aaa"
  22. when:
  23. String digest = test.interact(si)
  24. then:
  25. digest == "aaa"
  26. }
  27. }
  28.  
  29. plugins {
  30. id 'java'
  31. }
  32.  
  33. group 'test'
  34. version '1.0-SNAPSHOT'
  35.  
  36. sourceCompatibility = 1.8
  37.  
  38. repositories {
  39. mavenCentral()
  40. }
  41.  
  42. dependencies {
  43. testCompile group: 'org.spockframework', name: 'spock-core', version: '1.1-groovy-2.4'
  44. testCompile 'net.bytebuddy:byte-buddy:1.8.0'
  45. compile group: 'org.bouncycastle', name: 'bcpkix-jdk15on', version: '1.60'
  46. }
Add Comment
Please, Sign In to add comment