github.com/insolar/vanilla@v0.0.0-20201023172447-248fdf805322/cryptkit/data_signer_mock.go (about) 1 package cryptkit 2 3 // Code generated by http://github.com/gojuno/minimock (dev). DO NOT EDIT. 4 5 import ( 6 "io" 7 "sync" 8 mm_atomic "sync/atomic" 9 mm_time "time" 10 11 "github.com/gojuno/minimock/v3" 12 ) 13 14 // DataSignerMock implements DataSigner 15 type DataSignerMock struct { 16 t minimock.Tester 17 18 funcDigestBytes func(ba1 []byte) (d1 Digest) 19 inspectFuncDigestBytes func(ba1 []byte) 20 afterDigestBytesCounter uint64 21 beforeDigestBytesCounter uint64 22 DigestBytesMock mDataSignerMockDigestBytes 23 24 funcDigestData func(r1 io.Reader) (d1 Digest) 25 inspectFuncDigestData func(r1 io.Reader) 26 afterDigestDataCounter uint64 27 beforeDigestDataCounter uint64 28 DigestDataMock mDataSignerMockDigestData 29 30 funcGetDigestMethod func() (d1 DigestMethod) 31 inspectFuncGetDigestMethod func() 32 afterGetDigestMethodCounter uint64 33 beforeGetDigestMethodCounter uint64 34 GetDigestMethodMock mDataSignerMockGetDigestMethod 35 36 funcGetDigestSize func() (i1 int) 37 inspectFuncGetDigestSize func() 38 afterGetDigestSizeCounter uint64 39 beforeGetDigestSizeCounter uint64 40 GetDigestSizeMock mDataSignerMockGetDigestSize 41 42 funcGetSignatureMethod func() (s1 SignatureMethod) 43 inspectFuncGetSignatureMethod func() 44 afterGetSignatureMethodCounter uint64 45 beforeGetSignatureMethodCounter uint64 46 GetSignatureMethodMock mDataSignerMockGetSignatureMethod 47 48 funcGetSigningMethod func() (s1 SigningMethod) 49 inspectFuncGetSigningMethod func() 50 afterGetSigningMethodCounter uint64 51 beforeGetSigningMethodCounter uint64 52 GetSigningMethodMock mDataSignerMockGetSigningMethod 53 54 funcNewHasher func() (d1 DigestHasher) 55 inspectFuncNewHasher func() 56 afterNewHasherCounter uint64 57 beforeNewHasherCounter uint64 58 NewHasherMock mDataSignerMockNewHasher 59 60 funcSignDigest func(digest Digest) (s1 Signature) 61 inspectFuncSignDigest func(digest Digest) 62 afterSignDigestCounter uint64 63 beforeSignDigestCounter uint64 64 SignDigestMock mDataSignerMockSignDigest 65 } 66 67 // NewDataSignerMock returns a mock for DataSigner 68 func NewDataSignerMock(t minimock.Tester) *DataSignerMock { 69 m := &DataSignerMock{t: t} 70 if controller, ok := t.(minimock.MockController); ok { 71 controller.RegisterMocker(m) 72 } 73 74 m.DigestBytesMock = mDataSignerMockDigestBytes{mock: m} 75 m.DigestBytesMock.callArgs = []*DataSignerMockDigestBytesParams{} 76 77 m.DigestDataMock = mDataSignerMockDigestData{mock: m} 78 m.DigestDataMock.callArgs = []*DataSignerMockDigestDataParams{} 79 80 m.GetDigestMethodMock = mDataSignerMockGetDigestMethod{mock: m} 81 82 m.GetDigestSizeMock = mDataSignerMockGetDigestSize{mock: m} 83 84 m.GetSignatureMethodMock = mDataSignerMockGetSignatureMethod{mock: m} 85 86 m.GetSigningMethodMock = mDataSignerMockGetSigningMethod{mock: m} 87 88 m.NewHasherMock = mDataSignerMockNewHasher{mock: m} 89 90 m.SignDigestMock = mDataSignerMockSignDigest{mock: m} 91 m.SignDigestMock.callArgs = []*DataSignerMockSignDigestParams{} 92 93 return m 94 } 95 96 type mDataSignerMockDigestBytes struct { 97 mock *DataSignerMock 98 defaultExpectation *DataSignerMockDigestBytesExpectation 99 expectations []*DataSignerMockDigestBytesExpectation 100 101 callArgs []*DataSignerMockDigestBytesParams 102 mutex sync.RWMutex 103 } 104 105 // DataSignerMockDigestBytesExpectation specifies expectation struct of the DataSigner.DigestBytes 106 type DataSignerMockDigestBytesExpectation struct { 107 mock *DataSignerMock 108 params *DataSignerMockDigestBytesParams 109 results *DataSignerMockDigestBytesResults 110 Counter uint64 111 } 112 113 // DataSignerMockDigestBytesParams contains parameters of the DataSigner.DigestBytes 114 type DataSignerMockDigestBytesParams struct { 115 ba1 []byte 116 } 117 118 // DataSignerMockDigestBytesResults contains results of the DataSigner.DigestBytes 119 type DataSignerMockDigestBytesResults struct { 120 d1 Digest 121 } 122 123 // Expect sets up expected params for DataSigner.DigestBytes 124 func (mmDigestBytes *mDataSignerMockDigestBytes) Expect(ba1 []byte) *mDataSignerMockDigestBytes { 125 if mmDigestBytes.mock.funcDigestBytes != nil { 126 mmDigestBytes.mock.t.Fatalf("DataSignerMock.DigestBytes mock is already set by Set") 127 } 128 129 if mmDigestBytes.defaultExpectation == nil { 130 mmDigestBytes.defaultExpectation = &DataSignerMockDigestBytesExpectation{} 131 } 132 133 mmDigestBytes.defaultExpectation.params = &DataSignerMockDigestBytesParams{ba1} 134 for _, e := range mmDigestBytes.expectations { 135 if minimock.Equal(e.params, mmDigestBytes.defaultExpectation.params) { 136 mmDigestBytes.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmDigestBytes.defaultExpectation.params) 137 } 138 } 139 140 return mmDigestBytes 141 } 142 143 // Inspect accepts an inspector function that has same arguments as the DataSigner.DigestBytes 144 func (mmDigestBytes *mDataSignerMockDigestBytes) Inspect(f func(ba1 []byte)) *mDataSignerMockDigestBytes { 145 if mmDigestBytes.mock.inspectFuncDigestBytes != nil { 146 mmDigestBytes.mock.t.Fatalf("Inspect function is already set for DataSignerMock.DigestBytes") 147 } 148 149 mmDigestBytes.mock.inspectFuncDigestBytes = f 150 151 return mmDigestBytes 152 } 153 154 // Return sets up results that will be returned by DataSigner.DigestBytes 155 func (mmDigestBytes *mDataSignerMockDigestBytes) Return(d1 Digest) *DataSignerMock { 156 if mmDigestBytes.mock.funcDigestBytes != nil { 157 mmDigestBytes.mock.t.Fatalf("DataSignerMock.DigestBytes mock is already set by Set") 158 } 159 160 if mmDigestBytes.defaultExpectation == nil { 161 mmDigestBytes.defaultExpectation = &DataSignerMockDigestBytesExpectation{mock: mmDigestBytes.mock} 162 } 163 mmDigestBytes.defaultExpectation.results = &DataSignerMockDigestBytesResults{d1} 164 return mmDigestBytes.mock 165 } 166 167 //Set uses given function f to mock the DataSigner.DigestBytes method 168 func (mmDigestBytes *mDataSignerMockDigestBytes) Set(f func(ba1 []byte) (d1 Digest)) *DataSignerMock { 169 if mmDigestBytes.defaultExpectation != nil { 170 mmDigestBytes.mock.t.Fatalf("Default expectation is already set for the DataSigner.DigestBytes method") 171 } 172 173 if len(mmDigestBytes.expectations) > 0 { 174 mmDigestBytes.mock.t.Fatalf("Some expectations are already set for the DataSigner.DigestBytes method") 175 } 176 177 mmDigestBytes.mock.funcDigestBytes = f 178 return mmDigestBytes.mock 179 } 180 181 // When sets expectation for the DataSigner.DigestBytes which will trigger the result defined by the following 182 // Then helper 183 func (mmDigestBytes *mDataSignerMockDigestBytes) When(ba1 []byte) *DataSignerMockDigestBytesExpectation { 184 if mmDigestBytes.mock.funcDigestBytes != nil { 185 mmDigestBytes.mock.t.Fatalf("DataSignerMock.DigestBytes mock is already set by Set") 186 } 187 188 expectation := &DataSignerMockDigestBytesExpectation{ 189 mock: mmDigestBytes.mock, 190 params: &DataSignerMockDigestBytesParams{ba1}, 191 } 192 mmDigestBytes.expectations = append(mmDigestBytes.expectations, expectation) 193 return expectation 194 } 195 196 // Then sets up DataSigner.DigestBytes return parameters for the expectation previously defined by the When method 197 func (e *DataSignerMockDigestBytesExpectation) Then(d1 Digest) *DataSignerMock { 198 e.results = &DataSignerMockDigestBytesResults{d1} 199 return e.mock 200 } 201 202 // DigestBytes implements DataSigner 203 func (mmDigestBytes *DataSignerMock) DigestBytes(ba1 []byte) (d1 Digest) { 204 mm_atomic.AddUint64(&mmDigestBytes.beforeDigestBytesCounter, 1) 205 defer mm_atomic.AddUint64(&mmDigestBytes.afterDigestBytesCounter, 1) 206 207 if mmDigestBytes.inspectFuncDigestBytes != nil { 208 mmDigestBytes.inspectFuncDigestBytes(ba1) 209 } 210 211 mm_params := &DataSignerMockDigestBytesParams{ba1} 212 213 // Record call args 214 mmDigestBytes.DigestBytesMock.mutex.Lock() 215 mmDigestBytes.DigestBytesMock.callArgs = append(mmDigestBytes.DigestBytesMock.callArgs, mm_params) 216 mmDigestBytes.DigestBytesMock.mutex.Unlock() 217 218 for _, e := range mmDigestBytes.DigestBytesMock.expectations { 219 if minimock.Equal(e.params, mm_params) { 220 mm_atomic.AddUint64(&e.Counter, 1) 221 return e.results.d1 222 } 223 } 224 225 if mmDigestBytes.DigestBytesMock.defaultExpectation != nil { 226 mm_atomic.AddUint64(&mmDigestBytes.DigestBytesMock.defaultExpectation.Counter, 1) 227 mm_want := mmDigestBytes.DigestBytesMock.defaultExpectation.params 228 mm_got := DataSignerMockDigestBytesParams{ba1} 229 if mm_want != nil && !minimock.Equal(*mm_want, mm_got) { 230 mmDigestBytes.t.Errorf("DataSignerMock.DigestBytes got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) 231 } 232 233 mm_results := mmDigestBytes.DigestBytesMock.defaultExpectation.results 234 if mm_results == nil { 235 mmDigestBytes.t.Fatal("No results are set for the DataSignerMock.DigestBytes") 236 } 237 return (*mm_results).d1 238 } 239 if mmDigestBytes.funcDigestBytes != nil { 240 return mmDigestBytes.funcDigestBytes(ba1) 241 } 242 mmDigestBytes.t.Fatalf("Unexpected call to DataSignerMock.DigestBytes. %v", ba1) 243 return 244 } 245 246 // DigestBytesAfterCounter returns a count of finished DataSignerMock.DigestBytes invocations 247 func (mmDigestBytes *DataSignerMock) DigestBytesAfterCounter() uint64 { 248 return mm_atomic.LoadUint64(&mmDigestBytes.afterDigestBytesCounter) 249 } 250 251 // DigestBytesBeforeCounter returns a count of DataSignerMock.DigestBytes invocations 252 func (mmDigestBytes *DataSignerMock) DigestBytesBeforeCounter() uint64 { 253 return mm_atomic.LoadUint64(&mmDigestBytes.beforeDigestBytesCounter) 254 } 255 256 // Calls returns a list of arguments used in each call to DataSignerMock.DigestBytes. 257 // The list is in the same order as the calls were made (i.e. recent calls have a higher index) 258 func (mmDigestBytes *mDataSignerMockDigestBytes) Calls() []*DataSignerMockDigestBytesParams { 259 mmDigestBytes.mutex.RLock() 260 261 argCopy := make([]*DataSignerMockDigestBytesParams, len(mmDigestBytes.callArgs)) 262 copy(argCopy, mmDigestBytes.callArgs) 263 264 mmDigestBytes.mutex.RUnlock() 265 266 return argCopy 267 } 268 269 // MinimockDigestBytesDone returns true if the count of the DigestBytes invocations corresponds 270 // the number of defined expectations 271 func (m *DataSignerMock) MinimockDigestBytesDone() bool { 272 for _, e := range m.DigestBytesMock.expectations { 273 if mm_atomic.LoadUint64(&e.Counter) < 1 { 274 return false 275 } 276 } 277 278 // if default expectation was set then invocations count should be greater than zero 279 if m.DigestBytesMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterDigestBytesCounter) < 1 { 280 return false 281 } 282 // if func was set then invocations count should be greater than zero 283 if m.funcDigestBytes != nil && mm_atomic.LoadUint64(&m.afterDigestBytesCounter) < 1 { 284 return false 285 } 286 return true 287 } 288 289 // MinimockDigestBytesInspect logs each unmet expectation 290 func (m *DataSignerMock) MinimockDigestBytesInspect() { 291 for _, e := range m.DigestBytesMock.expectations { 292 if mm_atomic.LoadUint64(&e.Counter) < 1 { 293 m.t.Errorf("Expected call to DataSignerMock.DigestBytes with params: %#v", *e.params) 294 } 295 } 296 297 // if default expectation was set then invocations count should be greater than zero 298 if m.DigestBytesMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterDigestBytesCounter) < 1 { 299 if m.DigestBytesMock.defaultExpectation.params == nil { 300 m.t.Error("Expected call to DataSignerMock.DigestBytes") 301 } else { 302 m.t.Errorf("Expected call to DataSignerMock.DigestBytes with params: %#v", *m.DigestBytesMock.defaultExpectation.params) 303 } 304 } 305 // if func was set then invocations count should be greater than zero 306 if m.funcDigestBytes != nil && mm_atomic.LoadUint64(&m.afterDigestBytesCounter) < 1 { 307 m.t.Error("Expected call to DataSignerMock.DigestBytes") 308 } 309 } 310 311 type mDataSignerMockDigestData struct { 312 mock *DataSignerMock 313 defaultExpectation *DataSignerMockDigestDataExpectation 314 expectations []*DataSignerMockDigestDataExpectation 315 316 callArgs []*DataSignerMockDigestDataParams 317 mutex sync.RWMutex 318 } 319 320 // DataSignerMockDigestDataExpectation specifies expectation struct of the DataSigner.DigestData 321 type DataSignerMockDigestDataExpectation struct { 322 mock *DataSignerMock 323 params *DataSignerMockDigestDataParams 324 results *DataSignerMockDigestDataResults 325 Counter uint64 326 } 327 328 // DataSignerMockDigestDataParams contains parameters of the DataSigner.DigestData 329 type DataSignerMockDigestDataParams struct { 330 r1 io.Reader 331 } 332 333 // DataSignerMockDigestDataResults contains results of the DataSigner.DigestData 334 type DataSignerMockDigestDataResults struct { 335 d1 Digest 336 } 337 338 // Expect sets up expected params for DataSigner.DigestData 339 func (mmDigestData *mDataSignerMockDigestData) Expect(r1 io.Reader) *mDataSignerMockDigestData { 340 if mmDigestData.mock.funcDigestData != nil { 341 mmDigestData.mock.t.Fatalf("DataSignerMock.DigestData mock is already set by Set") 342 } 343 344 if mmDigestData.defaultExpectation == nil { 345 mmDigestData.defaultExpectation = &DataSignerMockDigestDataExpectation{} 346 } 347 348 mmDigestData.defaultExpectation.params = &DataSignerMockDigestDataParams{r1} 349 for _, e := range mmDigestData.expectations { 350 if minimock.Equal(e.params, mmDigestData.defaultExpectation.params) { 351 mmDigestData.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmDigestData.defaultExpectation.params) 352 } 353 } 354 355 return mmDigestData 356 } 357 358 // Inspect accepts an inspector function that has same arguments as the DataSigner.DigestData 359 func (mmDigestData *mDataSignerMockDigestData) Inspect(f func(r1 io.Reader)) *mDataSignerMockDigestData { 360 if mmDigestData.mock.inspectFuncDigestData != nil { 361 mmDigestData.mock.t.Fatalf("Inspect function is already set for DataSignerMock.DigestData") 362 } 363 364 mmDigestData.mock.inspectFuncDigestData = f 365 366 return mmDigestData 367 } 368 369 // Return sets up results that will be returned by DataSigner.DigestData 370 func (mmDigestData *mDataSignerMockDigestData) Return(d1 Digest) *DataSignerMock { 371 if mmDigestData.mock.funcDigestData != nil { 372 mmDigestData.mock.t.Fatalf("DataSignerMock.DigestData mock is already set by Set") 373 } 374 375 if mmDigestData.defaultExpectation == nil { 376 mmDigestData.defaultExpectation = &DataSignerMockDigestDataExpectation{mock: mmDigestData.mock} 377 } 378 mmDigestData.defaultExpectation.results = &DataSignerMockDigestDataResults{d1} 379 return mmDigestData.mock 380 } 381 382 //Set uses given function f to mock the DataSigner.DigestData method 383 func (mmDigestData *mDataSignerMockDigestData) Set(f func(r1 io.Reader) (d1 Digest)) *DataSignerMock { 384 if mmDigestData.defaultExpectation != nil { 385 mmDigestData.mock.t.Fatalf("Default expectation is already set for the DataSigner.DigestData method") 386 } 387 388 if len(mmDigestData.expectations) > 0 { 389 mmDigestData.mock.t.Fatalf("Some expectations are already set for the DataSigner.DigestData method") 390 } 391 392 mmDigestData.mock.funcDigestData = f 393 return mmDigestData.mock 394 } 395 396 // When sets expectation for the DataSigner.DigestData which will trigger the result defined by the following 397 // Then helper 398 func (mmDigestData *mDataSignerMockDigestData) When(r1 io.Reader) *DataSignerMockDigestDataExpectation { 399 if mmDigestData.mock.funcDigestData != nil { 400 mmDigestData.mock.t.Fatalf("DataSignerMock.DigestData mock is already set by Set") 401 } 402 403 expectation := &DataSignerMockDigestDataExpectation{ 404 mock: mmDigestData.mock, 405 params: &DataSignerMockDigestDataParams{r1}, 406 } 407 mmDigestData.expectations = append(mmDigestData.expectations, expectation) 408 return expectation 409 } 410 411 // Then sets up DataSigner.DigestData return parameters for the expectation previously defined by the When method 412 func (e *DataSignerMockDigestDataExpectation) Then(d1 Digest) *DataSignerMock { 413 e.results = &DataSignerMockDigestDataResults{d1} 414 return e.mock 415 } 416 417 // DigestData implements DataSigner 418 func (mmDigestData *DataSignerMock) DigestData(r1 io.Reader) (d1 Digest) { 419 mm_atomic.AddUint64(&mmDigestData.beforeDigestDataCounter, 1) 420 defer mm_atomic.AddUint64(&mmDigestData.afterDigestDataCounter, 1) 421 422 if mmDigestData.inspectFuncDigestData != nil { 423 mmDigestData.inspectFuncDigestData(r1) 424 } 425 426 mm_params := &DataSignerMockDigestDataParams{r1} 427 428 // Record call args 429 mmDigestData.DigestDataMock.mutex.Lock() 430 mmDigestData.DigestDataMock.callArgs = append(mmDigestData.DigestDataMock.callArgs, mm_params) 431 mmDigestData.DigestDataMock.mutex.Unlock() 432 433 for _, e := range mmDigestData.DigestDataMock.expectations { 434 if minimock.Equal(e.params, mm_params) { 435 mm_atomic.AddUint64(&e.Counter, 1) 436 return e.results.d1 437 } 438 } 439 440 if mmDigestData.DigestDataMock.defaultExpectation != nil { 441 mm_atomic.AddUint64(&mmDigestData.DigestDataMock.defaultExpectation.Counter, 1) 442 mm_want := mmDigestData.DigestDataMock.defaultExpectation.params 443 mm_got := DataSignerMockDigestDataParams{r1} 444 if mm_want != nil && !minimock.Equal(*mm_want, mm_got) { 445 mmDigestData.t.Errorf("DataSignerMock.DigestData got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) 446 } 447 448 mm_results := mmDigestData.DigestDataMock.defaultExpectation.results 449 if mm_results == nil { 450 mmDigestData.t.Fatal("No results are set for the DataSignerMock.DigestData") 451 } 452 return (*mm_results).d1 453 } 454 if mmDigestData.funcDigestData != nil { 455 return mmDigestData.funcDigestData(r1) 456 } 457 mmDigestData.t.Fatalf("Unexpected call to DataSignerMock.DigestData. %v", r1) 458 return 459 } 460 461 // DigestDataAfterCounter returns a count of finished DataSignerMock.DigestData invocations 462 func (mmDigestData *DataSignerMock) DigestDataAfterCounter() uint64 { 463 return mm_atomic.LoadUint64(&mmDigestData.afterDigestDataCounter) 464 } 465 466 // DigestDataBeforeCounter returns a count of DataSignerMock.DigestData invocations 467 func (mmDigestData *DataSignerMock) DigestDataBeforeCounter() uint64 { 468 return mm_atomic.LoadUint64(&mmDigestData.beforeDigestDataCounter) 469 } 470 471 // Calls returns a list of arguments used in each call to DataSignerMock.DigestData. 472 // The list is in the same order as the calls were made (i.e. recent calls have a higher index) 473 func (mmDigestData *mDataSignerMockDigestData) Calls() []*DataSignerMockDigestDataParams { 474 mmDigestData.mutex.RLock() 475 476 argCopy := make([]*DataSignerMockDigestDataParams, len(mmDigestData.callArgs)) 477 copy(argCopy, mmDigestData.callArgs) 478 479 mmDigestData.mutex.RUnlock() 480 481 return argCopy 482 } 483 484 // MinimockDigestDataDone returns true if the count of the DigestData invocations corresponds 485 // the number of defined expectations 486 func (m *DataSignerMock) MinimockDigestDataDone() bool { 487 for _, e := range m.DigestDataMock.expectations { 488 if mm_atomic.LoadUint64(&e.Counter) < 1 { 489 return false 490 } 491 } 492 493 // if default expectation was set then invocations count should be greater than zero 494 if m.DigestDataMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterDigestDataCounter) < 1 { 495 return false 496 } 497 // if func was set then invocations count should be greater than zero 498 if m.funcDigestData != nil && mm_atomic.LoadUint64(&m.afterDigestDataCounter) < 1 { 499 return false 500 } 501 return true 502 } 503 504 // MinimockDigestDataInspect logs each unmet expectation 505 func (m *DataSignerMock) MinimockDigestDataInspect() { 506 for _, e := range m.DigestDataMock.expectations { 507 if mm_atomic.LoadUint64(&e.Counter) < 1 { 508 m.t.Errorf("Expected call to DataSignerMock.DigestData with params: %#v", *e.params) 509 } 510 } 511 512 // if default expectation was set then invocations count should be greater than zero 513 if m.DigestDataMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterDigestDataCounter) < 1 { 514 if m.DigestDataMock.defaultExpectation.params == nil { 515 m.t.Error("Expected call to DataSignerMock.DigestData") 516 } else { 517 m.t.Errorf("Expected call to DataSignerMock.DigestData with params: %#v", *m.DigestDataMock.defaultExpectation.params) 518 } 519 } 520 // if func was set then invocations count should be greater than zero 521 if m.funcDigestData != nil && mm_atomic.LoadUint64(&m.afterDigestDataCounter) < 1 { 522 m.t.Error("Expected call to DataSignerMock.DigestData") 523 } 524 } 525 526 type mDataSignerMockGetDigestMethod struct { 527 mock *DataSignerMock 528 defaultExpectation *DataSignerMockGetDigestMethodExpectation 529 expectations []*DataSignerMockGetDigestMethodExpectation 530 } 531 532 // DataSignerMockGetDigestMethodExpectation specifies expectation struct of the DataSigner.GetDigestMethod 533 type DataSignerMockGetDigestMethodExpectation struct { 534 mock *DataSignerMock 535 536 results *DataSignerMockGetDigestMethodResults 537 Counter uint64 538 } 539 540 // DataSignerMockGetDigestMethodResults contains results of the DataSigner.GetDigestMethod 541 type DataSignerMockGetDigestMethodResults struct { 542 d1 DigestMethod 543 } 544 545 // Expect sets up expected params for DataSigner.GetDigestMethod 546 func (mmGetDigestMethod *mDataSignerMockGetDigestMethod) Expect() *mDataSignerMockGetDigestMethod { 547 if mmGetDigestMethod.mock.funcGetDigestMethod != nil { 548 mmGetDigestMethod.mock.t.Fatalf("DataSignerMock.GetDigestMethod mock is already set by Set") 549 } 550 551 if mmGetDigestMethod.defaultExpectation == nil { 552 mmGetDigestMethod.defaultExpectation = &DataSignerMockGetDigestMethodExpectation{} 553 } 554 555 return mmGetDigestMethod 556 } 557 558 // Inspect accepts an inspector function that has same arguments as the DataSigner.GetDigestMethod 559 func (mmGetDigestMethod *mDataSignerMockGetDigestMethod) Inspect(f func()) *mDataSignerMockGetDigestMethod { 560 if mmGetDigestMethod.mock.inspectFuncGetDigestMethod != nil { 561 mmGetDigestMethod.mock.t.Fatalf("Inspect function is already set for DataSignerMock.GetDigestMethod") 562 } 563 564 mmGetDigestMethod.mock.inspectFuncGetDigestMethod = f 565 566 return mmGetDigestMethod 567 } 568 569 // Return sets up results that will be returned by DataSigner.GetDigestMethod 570 func (mmGetDigestMethod *mDataSignerMockGetDigestMethod) Return(d1 DigestMethod) *DataSignerMock { 571 if mmGetDigestMethod.mock.funcGetDigestMethod != nil { 572 mmGetDigestMethod.mock.t.Fatalf("DataSignerMock.GetDigestMethod mock is already set by Set") 573 } 574 575 if mmGetDigestMethod.defaultExpectation == nil { 576 mmGetDigestMethod.defaultExpectation = &DataSignerMockGetDigestMethodExpectation{mock: mmGetDigestMethod.mock} 577 } 578 mmGetDigestMethod.defaultExpectation.results = &DataSignerMockGetDigestMethodResults{d1} 579 return mmGetDigestMethod.mock 580 } 581 582 //Set uses given function f to mock the DataSigner.GetDigestMethod method 583 func (mmGetDigestMethod *mDataSignerMockGetDigestMethod) Set(f func() (d1 DigestMethod)) *DataSignerMock { 584 if mmGetDigestMethod.defaultExpectation != nil { 585 mmGetDigestMethod.mock.t.Fatalf("Default expectation is already set for the DataSigner.GetDigestMethod method") 586 } 587 588 if len(mmGetDigestMethod.expectations) > 0 { 589 mmGetDigestMethod.mock.t.Fatalf("Some expectations are already set for the DataSigner.GetDigestMethod method") 590 } 591 592 mmGetDigestMethod.mock.funcGetDigestMethod = f 593 return mmGetDigestMethod.mock 594 } 595 596 // GetDigestMethod implements DataSigner 597 func (mmGetDigestMethod *DataSignerMock) GetDigestMethod() (d1 DigestMethod) { 598 mm_atomic.AddUint64(&mmGetDigestMethod.beforeGetDigestMethodCounter, 1) 599 defer mm_atomic.AddUint64(&mmGetDigestMethod.afterGetDigestMethodCounter, 1) 600 601 if mmGetDigestMethod.inspectFuncGetDigestMethod != nil { 602 mmGetDigestMethod.inspectFuncGetDigestMethod() 603 } 604 605 if mmGetDigestMethod.GetDigestMethodMock.defaultExpectation != nil { 606 mm_atomic.AddUint64(&mmGetDigestMethod.GetDigestMethodMock.defaultExpectation.Counter, 1) 607 608 mm_results := mmGetDigestMethod.GetDigestMethodMock.defaultExpectation.results 609 if mm_results == nil { 610 mmGetDigestMethod.t.Fatal("No results are set for the DataSignerMock.GetDigestMethod") 611 } 612 return (*mm_results).d1 613 } 614 if mmGetDigestMethod.funcGetDigestMethod != nil { 615 return mmGetDigestMethod.funcGetDigestMethod() 616 } 617 mmGetDigestMethod.t.Fatalf("Unexpected call to DataSignerMock.GetDigestMethod.") 618 return 619 } 620 621 // GetDigestMethodAfterCounter returns a count of finished DataSignerMock.GetDigestMethod invocations 622 func (mmGetDigestMethod *DataSignerMock) GetDigestMethodAfterCounter() uint64 { 623 return mm_atomic.LoadUint64(&mmGetDigestMethod.afterGetDigestMethodCounter) 624 } 625 626 // GetDigestMethodBeforeCounter returns a count of DataSignerMock.GetDigestMethod invocations 627 func (mmGetDigestMethod *DataSignerMock) GetDigestMethodBeforeCounter() uint64 { 628 return mm_atomic.LoadUint64(&mmGetDigestMethod.beforeGetDigestMethodCounter) 629 } 630 631 // MinimockGetDigestMethodDone returns true if the count of the GetDigestMethod invocations corresponds 632 // the number of defined expectations 633 func (m *DataSignerMock) MinimockGetDigestMethodDone() bool { 634 for _, e := range m.GetDigestMethodMock.expectations { 635 if mm_atomic.LoadUint64(&e.Counter) < 1 { 636 return false 637 } 638 } 639 640 // if default expectation was set then invocations count should be greater than zero 641 if m.GetDigestMethodMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterGetDigestMethodCounter) < 1 { 642 return false 643 } 644 // if func was set then invocations count should be greater than zero 645 if m.funcGetDigestMethod != nil && mm_atomic.LoadUint64(&m.afterGetDigestMethodCounter) < 1 { 646 return false 647 } 648 return true 649 } 650 651 // MinimockGetDigestMethodInspect logs each unmet expectation 652 func (m *DataSignerMock) MinimockGetDigestMethodInspect() { 653 for _, e := range m.GetDigestMethodMock.expectations { 654 if mm_atomic.LoadUint64(&e.Counter) < 1 { 655 m.t.Error("Expected call to DataSignerMock.GetDigestMethod") 656 } 657 } 658 659 // if default expectation was set then invocations count should be greater than zero 660 if m.GetDigestMethodMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterGetDigestMethodCounter) < 1 { 661 m.t.Error("Expected call to DataSignerMock.GetDigestMethod") 662 } 663 // if func was set then invocations count should be greater than zero 664 if m.funcGetDigestMethod != nil && mm_atomic.LoadUint64(&m.afterGetDigestMethodCounter) < 1 { 665 m.t.Error("Expected call to DataSignerMock.GetDigestMethod") 666 } 667 } 668 669 type mDataSignerMockGetDigestSize struct { 670 mock *DataSignerMock 671 defaultExpectation *DataSignerMockGetDigestSizeExpectation 672 expectations []*DataSignerMockGetDigestSizeExpectation 673 } 674 675 // DataSignerMockGetDigestSizeExpectation specifies expectation struct of the DataSigner.GetDigestSize 676 type DataSignerMockGetDigestSizeExpectation struct { 677 mock *DataSignerMock 678 679 results *DataSignerMockGetDigestSizeResults 680 Counter uint64 681 } 682 683 // DataSignerMockGetDigestSizeResults contains results of the DataSigner.GetDigestSize 684 type DataSignerMockGetDigestSizeResults struct { 685 i1 int 686 } 687 688 // Expect sets up expected params for DataSigner.GetDigestSize 689 func (mmGetDigestSize *mDataSignerMockGetDigestSize) Expect() *mDataSignerMockGetDigestSize { 690 if mmGetDigestSize.mock.funcGetDigestSize != nil { 691 mmGetDigestSize.mock.t.Fatalf("DataSignerMock.GetDigestSize mock is already set by Set") 692 } 693 694 if mmGetDigestSize.defaultExpectation == nil { 695 mmGetDigestSize.defaultExpectation = &DataSignerMockGetDigestSizeExpectation{} 696 } 697 698 return mmGetDigestSize 699 } 700 701 // Inspect accepts an inspector function that has same arguments as the DataSigner.GetDigestSize 702 func (mmGetDigestSize *mDataSignerMockGetDigestSize) Inspect(f func()) *mDataSignerMockGetDigestSize { 703 if mmGetDigestSize.mock.inspectFuncGetDigestSize != nil { 704 mmGetDigestSize.mock.t.Fatalf("Inspect function is already set for DataSignerMock.GetDigestSize") 705 } 706 707 mmGetDigestSize.mock.inspectFuncGetDigestSize = f 708 709 return mmGetDigestSize 710 } 711 712 // Return sets up results that will be returned by DataSigner.GetDigestSize 713 func (mmGetDigestSize *mDataSignerMockGetDigestSize) Return(i1 int) *DataSignerMock { 714 if mmGetDigestSize.mock.funcGetDigestSize != nil { 715 mmGetDigestSize.mock.t.Fatalf("DataSignerMock.GetDigestSize mock is already set by Set") 716 } 717 718 if mmGetDigestSize.defaultExpectation == nil { 719 mmGetDigestSize.defaultExpectation = &DataSignerMockGetDigestSizeExpectation{mock: mmGetDigestSize.mock} 720 } 721 mmGetDigestSize.defaultExpectation.results = &DataSignerMockGetDigestSizeResults{i1} 722 return mmGetDigestSize.mock 723 } 724 725 //Set uses given function f to mock the DataSigner.GetDigestSize method 726 func (mmGetDigestSize *mDataSignerMockGetDigestSize) Set(f func() (i1 int)) *DataSignerMock { 727 if mmGetDigestSize.defaultExpectation != nil { 728 mmGetDigestSize.mock.t.Fatalf("Default expectation is already set for the DataSigner.GetDigestSize method") 729 } 730 731 if len(mmGetDigestSize.expectations) > 0 { 732 mmGetDigestSize.mock.t.Fatalf("Some expectations are already set for the DataSigner.GetDigestSize method") 733 } 734 735 mmGetDigestSize.mock.funcGetDigestSize = f 736 return mmGetDigestSize.mock 737 } 738 739 // GetDigestSize implements DataSigner 740 func (mmGetDigestSize *DataSignerMock) GetDigestSize() (i1 int) { 741 mm_atomic.AddUint64(&mmGetDigestSize.beforeGetDigestSizeCounter, 1) 742 defer mm_atomic.AddUint64(&mmGetDigestSize.afterGetDigestSizeCounter, 1) 743 744 if mmGetDigestSize.inspectFuncGetDigestSize != nil { 745 mmGetDigestSize.inspectFuncGetDigestSize() 746 } 747 748 if mmGetDigestSize.GetDigestSizeMock.defaultExpectation != nil { 749 mm_atomic.AddUint64(&mmGetDigestSize.GetDigestSizeMock.defaultExpectation.Counter, 1) 750 751 mm_results := mmGetDigestSize.GetDigestSizeMock.defaultExpectation.results 752 if mm_results == nil { 753 mmGetDigestSize.t.Fatal("No results are set for the DataSignerMock.GetDigestSize") 754 } 755 return (*mm_results).i1 756 } 757 if mmGetDigestSize.funcGetDigestSize != nil { 758 return mmGetDigestSize.funcGetDigestSize() 759 } 760 mmGetDigestSize.t.Fatalf("Unexpected call to DataSignerMock.GetDigestSize.") 761 return 762 } 763 764 // GetDigestSizeAfterCounter returns a count of finished DataSignerMock.GetDigestSize invocations 765 func (mmGetDigestSize *DataSignerMock) GetDigestSizeAfterCounter() uint64 { 766 return mm_atomic.LoadUint64(&mmGetDigestSize.afterGetDigestSizeCounter) 767 } 768 769 // GetDigestSizeBeforeCounter returns a count of DataSignerMock.GetDigestSize invocations 770 func (mmGetDigestSize *DataSignerMock) GetDigestSizeBeforeCounter() uint64 { 771 return mm_atomic.LoadUint64(&mmGetDigestSize.beforeGetDigestSizeCounter) 772 } 773 774 // MinimockGetDigestSizeDone returns true if the count of the GetDigestSize invocations corresponds 775 // the number of defined expectations 776 func (m *DataSignerMock) MinimockGetDigestSizeDone() bool { 777 for _, e := range m.GetDigestSizeMock.expectations { 778 if mm_atomic.LoadUint64(&e.Counter) < 1 { 779 return false 780 } 781 } 782 783 // if default expectation was set then invocations count should be greater than zero 784 if m.GetDigestSizeMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterGetDigestSizeCounter) < 1 { 785 return false 786 } 787 // if func was set then invocations count should be greater than zero 788 if m.funcGetDigestSize != nil && mm_atomic.LoadUint64(&m.afterGetDigestSizeCounter) < 1 { 789 return false 790 } 791 return true 792 } 793 794 // MinimockGetDigestSizeInspect logs each unmet expectation 795 func (m *DataSignerMock) MinimockGetDigestSizeInspect() { 796 for _, e := range m.GetDigestSizeMock.expectations { 797 if mm_atomic.LoadUint64(&e.Counter) < 1 { 798 m.t.Error("Expected call to DataSignerMock.GetDigestSize") 799 } 800 } 801 802 // if default expectation was set then invocations count should be greater than zero 803 if m.GetDigestSizeMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterGetDigestSizeCounter) < 1 { 804 m.t.Error("Expected call to DataSignerMock.GetDigestSize") 805 } 806 // if func was set then invocations count should be greater than zero 807 if m.funcGetDigestSize != nil && mm_atomic.LoadUint64(&m.afterGetDigestSizeCounter) < 1 { 808 m.t.Error("Expected call to DataSignerMock.GetDigestSize") 809 } 810 } 811 812 type mDataSignerMockGetSignatureMethod struct { 813 mock *DataSignerMock 814 defaultExpectation *DataSignerMockGetSignatureMethodExpectation 815 expectations []*DataSignerMockGetSignatureMethodExpectation 816 } 817 818 // DataSignerMockGetSignatureMethodExpectation specifies expectation struct of the DataSigner.GetSignatureMethod 819 type DataSignerMockGetSignatureMethodExpectation struct { 820 mock *DataSignerMock 821 822 results *DataSignerMockGetSignatureMethodResults 823 Counter uint64 824 } 825 826 // DataSignerMockGetSignatureMethodResults contains results of the DataSigner.GetSignatureMethod 827 type DataSignerMockGetSignatureMethodResults struct { 828 s1 SignatureMethod 829 } 830 831 // Expect sets up expected params for DataSigner.GetSignatureMethod 832 func (mmGetSignatureMethod *mDataSignerMockGetSignatureMethod) Expect() *mDataSignerMockGetSignatureMethod { 833 if mmGetSignatureMethod.mock.funcGetSignatureMethod != nil { 834 mmGetSignatureMethod.mock.t.Fatalf("DataSignerMock.GetSignatureMethod mock is already set by Set") 835 } 836 837 if mmGetSignatureMethod.defaultExpectation == nil { 838 mmGetSignatureMethod.defaultExpectation = &DataSignerMockGetSignatureMethodExpectation{} 839 } 840 841 return mmGetSignatureMethod 842 } 843 844 // Inspect accepts an inspector function that has same arguments as the DataSigner.GetSignatureMethod 845 func (mmGetSignatureMethod *mDataSignerMockGetSignatureMethod) Inspect(f func()) *mDataSignerMockGetSignatureMethod { 846 if mmGetSignatureMethod.mock.inspectFuncGetSignatureMethod != nil { 847 mmGetSignatureMethod.mock.t.Fatalf("Inspect function is already set for DataSignerMock.GetSignatureMethod") 848 } 849 850 mmGetSignatureMethod.mock.inspectFuncGetSignatureMethod = f 851 852 return mmGetSignatureMethod 853 } 854 855 // Return sets up results that will be returned by DataSigner.GetSignatureMethod 856 func (mmGetSignatureMethod *mDataSignerMockGetSignatureMethod) Return(s1 SignatureMethod) *DataSignerMock { 857 if mmGetSignatureMethod.mock.funcGetSignatureMethod != nil { 858 mmGetSignatureMethod.mock.t.Fatalf("DataSignerMock.GetSignatureMethod mock is already set by Set") 859 } 860 861 if mmGetSignatureMethod.defaultExpectation == nil { 862 mmGetSignatureMethod.defaultExpectation = &DataSignerMockGetSignatureMethodExpectation{mock: mmGetSignatureMethod.mock} 863 } 864 mmGetSignatureMethod.defaultExpectation.results = &DataSignerMockGetSignatureMethodResults{s1} 865 return mmGetSignatureMethod.mock 866 } 867 868 //Set uses given function f to mock the DataSigner.GetSignatureMethod method 869 func (mmGetSignatureMethod *mDataSignerMockGetSignatureMethod) Set(f func() (s1 SignatureMethod)) *DataSignerMock { 870 if mmGetSignatureMethod.defaultExpectation != nil { 871 mmGetSignatureMethod.mock.t.Fatalf("Default expectation is already set for the DataSigner.GetSignatureMethod method") 872 } 873 874 if len(mmGetSignatureMethod.expectations) > 0 { 875 mmGetSignatureMethod.mock.t.Fatalf("Some expectations are already set for the DataSigner.GetSignatureMethod method") 876 } 877 878 mmGetSignatureMethod.mock.funcGetSignatureMethod = f 879 return mmGetSignatureMethod.mock 880 } 881 882 // GetSignatureMethod implements DataSigner 883 func (mmGetSignatureMethod *DataSignerMock) GetSignatureMethod() (s1 SignatureMethod) { 884 mm_atomic.AddUint64(&mmGetSignatureMethod.beforeGetSignatureMethodCounter, 1) 885 defer mm_atomic.AddUint64(&mmGetSignatureMethod.afterGetSignatureMethodCounter, 1) 886 887 if mmGetSignatureMethod.inspectFuncGetSignatureMethod != nil { 888 mmGetSignatureMethod.inspectFuncGetSignatureMethod() 889 } 890 891 if mmGetSignatureMethod.GetSignatureMethodMock.defaultExpectation != nil { 892 mm_atomic.AddUint64(&mmGetSignatureMethod.GetSignatureMethodMock.defaultExpectation.Counter, 1) 893 894 mm_results := mmGetSignatureMethod.GetSignatureMethodMock.defaultExpectation.results 895 if mm_results == nil { 896 mmGetSignatureMethod.t.Fatal("No results are set for the DataSignerMock.GetSignatureMethod") 897 } 898 return (*mm_results).s1 899 } 900 if mmGetSignatureMethod.funcGetSignatureMethod != nil { 901 return mmGetSignatureMethod.funcGetSignatureMethod() 902 } 903 mmGetSignatureMethod.t.Fatalf("Unexpected call to DataSignerMock.GetSignatureMethod.") 904 return 905 } 906 907 // GetSignatureMethodAfterCounter returns a count of finished DataSignerMock.GetSignatureMethod invocations 908 func (mmGetSignatureMethod *DataSignerMock) GetSignatureMethodAfterCounter() uint64 { 909 return mm_atomic.LoadUint64(&mmGetSignatureMethod.afterGetSignatureMethodCounter) 910 } 911 912 // GetSignatureMethodBeforeCounter returns a count of DataSignerMock.GetSignatureMethod invocations 913 func (mmGetSignatureMethod *DataSignerMock) GetSignatureMethodBeforeCounter() uint64 { 914 return mm_atomic.LoadUint64(&mmGetSignatureMethod.beforeGetSignatureMethodCounter) 915 } 916 917 // MinimockGetSignatureMethodDone returns true if the count of the GetSignatureMethod invocations corresponds 918 // the number of defined expectations 919 func (m *DataSignerMock) MinimockGetSignatureMethodDone() bool { 920 for _, e := range m.GetSignatureMethodMock.expectations { 921 if mm_atomic.LoadUint64(&e.Counter) < 1 { 922 return false 923 } 924 } 925 926 // if default expectation was set then invocations count should be greater than zero 927 if m.GetSignatureMethodMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterGetSignatureMethodCounter) < 1 { 928 return false 929 } 930 // if func was set then invocations count should be greater than zero 931 if m.funcGetSignatureMethod != nil && mm_atomic.LoadUint64(&m.afterGetSignatureMethodCounter) < 1 { 932 return false 933 } 934 return true 935 } 936 937 // MinimockGetSignatureMethodInspect logs each unmet expectation 938 func (m *DataSignerMock) MinimockGetSignatureMethodInspect() { 939 for _, e := range m.GetSignatureMethodMock.expectations { 940 if mm_atomic.LoadUint64(&e.Counter) < 1 { 941 m.t.Error("Expected call to DataSignerMock.GetSignatureMethod") 942 } 943 } 944 945 // if default expectation was set then invocations count should be greater than zero 946 if m.GetSignatureMethodMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterGetSignatureMethodCounter) < 1 { 947 m.t.Error("Expected call to DataSignerMock.GetSignatureMethod") 948 } 949 // if func was set then invocations count should be greater than zero 950 if m.funcGetSignatureMethod != nil && mm_atomic.LoadUint64(&m.afterGetSignatureMethodCounter) < 1 { 951 m.t.Error("Expected call to DataSignerMock.GetSignatureMethod") 952 } 953 } 954 955 type mDataSignerMockGetSigningMethod struct { 956 mock *DataSignerMock 957 defaultExpectation *DataSignerMockGetSigningMethodExpectation 958 expectations []*DataSignerMockGetSigningMethodExpectation 959 } 960 961 // DataSignerMockGetSigningMethodExpectation specifies expectation struct of the DataSigner.GetSigningMethod 962 type DataSignerMockGetSigningMethodExpectation struct { 963 mock *DataSignerMock 964 965 results *DataSignerMockGetSigningMethodResults 966 Counter uint64 967 } 968 969 // DataSignerMockGetSigningMethodResults contains results of the DataSigner.GetSigningMethod 970 type DataSignerMockGetSigningMethodResults struct { 971 s1 SigningMethod 972 } 973 974 // Expect sets up expected params for DataSigner.GetSigningMethod 975 func (mmGetSigningMethod *mDataSignerMockGetSigningMethod) Expect() *mDataSignerMockGetSigningMethod { 976 if mmGetSigningMethod.mock.funcGetSigningMethod != nil { 977 mmGetSigningMethod.mock.t.Fatalf("DataSignerMock.GetSigningMethod mock is already set by Set") 978 } 979 980 if mmGetSigningMethod.defaultExpectation == nil { 981 mmGetSigningMethod.defaultExpectation = &DataSignerMockGetSigningMethodExpectation{} 982 } 983 984 return mmGetSigningMethod 985 } 986 987 // Inspect accepts an inspector function that has same arguments as the DataSigner.GetSigningMethod 988 func (mmGetSigningMethod *mDataSignerMockGetSigningMethod) Inspect(f func()) *mDataSignerMockGetSigningMethod { 989 if mmGetSigningMethod.mock.inspectFuncGetSigningMethod != nil { 990 mmGetSigningMethod.mock.t.Fatalf("Inspect function is already set for DataSignerMock.GetSigningMethod") 991 } 992 993 mmGetSigningMethod.mock.inspectFuncGetSigningMethod = f 994 995 return mmGetSigningMethod 996 } 997 998 // Return sets up results that will be returned by DataSigner.GetSigningMethod 999 func (mmGetSigningMethod *mDataSignerMockGetSigningMethod) Return(s1 SigningMethod) *DataSignerMock { 1000 if mmGetSigningMethod.mock.funcGetSigningMethod != nil { 1001 mmGetSigningMethod.mock.t.Fatalf("DataSignerMock.GetSigningMethod mock is already set by Set") 1002 } 1003 1004 if mmGetSigningMethod.defaultExpectation == nil { 1005 mmGetSigningMethod.defaultExpectation = &DataSignerMockGetSigningMethodExpectation{mock: mmGetSigningMethod.mock} 1006 } 1007 mmGetSigningMethod.defaultExpectation.results = &DataSignerMockGetSigningMethodResults{s1} 1008 return mmGetSigningMethod.mock 1009 } 1010 1011 //Set uses given function f to mock the DataSigner.GetSigningMethod method 1012 func (mmGetSigningMethod *mDataSignerMockGetSigningMethod) Set(f func() (s1 SigningMethod)) *DataSignerMock { 1013 if mmGetSigningMethod.defaultExpectation != nil { 1014 mmGetSigningMethod.mock.t.Fatalf("Default expectation is already set for the DataSigner.GetSigningMethod method") 1015 } 1016 1017 if len(mmGetSigningMethod.expectations) > 0 { 1018 mmGetSigningMethod.mock.t.Fatalf("Some expectations are already set for the DataSigner.GetSigningMethod method") 1019 } 1020 1021 mmGetSigningMethod.mock.funcGetSigningMethod = f 1022 return mmGetSigningMethod.mock 1023 } 1024 1025 // GetSigningMethod implements DataSigner 1026 func (mmGetSigningMethod *DataSignerMock) GetSigningMethod() (s1 SigningMethod) { 1027 mm_atomic.AddUint64(&mmGetSigningMethod.beforeGetSigningMethodCounter, 1) 1028 defer mm_atomic.AddUint64(&mmGetSigningMethod.afterGetSigningMethodCounter, 1) 1029 1030 if mmGetSigningMethod.inspectFuncGetSigningMethod != nil { 1031 mmGetSigningMethod.inspectFuncGetSigningMethod() 1032 } 1033 1034 if mmGetSigningMethod.GetSigningMethodMock.defaultExpectation != nil { 1035 mm_atomic.AddUint64(&mmGetSigningMethod.GetSigningMethodMock.defaultExpectation.Counter, 1) 1036 1037 mm_results := mmGetSigningMethod.GetSigningMethodMock.defaultExpectation.results 1038 if mm_results == nil { 1039 mmGetSigningMethod.t.Fatal("No results are set for the DataSignerMock.GetSigningMethod") 1040 } 1041 return (*mm_results).s1 1042 } 1043 if mmGetSigningMethod.funcGetSigningMethod != nil { 1044 return mmGetSigningMethod.funcGetSigningMethod() 1045 } 1046 mmGetSigningMethod.t.Fatalf("Unexpected call to DataSignerMock.GetSigningMethod.") 1047 return 1048 } 1049 1050 // GetSigningMethodAfterCounter returns a count of finished DataSignerMock.GetSigningMethod invocations 1051 func (mmGetSigningMethod *DataSignerMock) GetSigningMethodAfterCounter() uint64 { 1052 return mm_atomic.LoadUint64(&mmGetSigningMethod.afterGetSigningMethodCounter) 1053 } 1054 1055 // GetSigningMethodBeforeCounter returns a count of DataSignerMock.GetSigningMethod invocations 1056 func (mmGetSigningMethod *DataSignerMock) GetSigningMethodBeforeCounter() uint64 { 1057 return mm_atomic.LoadUint64(&mmGetSigningMethod.beforeGetSigningMethodCounter) 1058 } 1059 1060 // MinimockGetSigningMethodDone returns true if the count of the GetSigningMethod invocations corresponds 1061 // the number of defined expectations 1062 func (m *DataSignerMock) MinimockGetSigningMethodDone() bool { 1063 for _, e := range m.GetSigningMethodMock.expectations { 1064 if mm_atomic.LoadUint64(&e.Counter) < 1 { 1065 return false 1066 } 1067 } 1068 1069 // if default expectation was set then invocations count should be greater than zero 1070 if m.GetSigningMethodMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterGetSigningMethodCounter) < 1 { 1071 return false 1072 } 1073 // if func was set then invocations count should be greater than zero 1074 if m.funcGetSigningMethod != nil && mm_atomic.LoadUint64(&m.afterGetSigningMethodCounter) < 1 { 1075 return false 1076 } 1077 return true 1078 } 1079 1080 // MinimockGetSigningMethodInspect logs each unmet expectation 1081 func (m *DataSignerMock) MinimockGetSigningMethodInspect() { 1082 for _, e := range m.GetSigningMethodMock.expectations { 1083 if mm_atomic.LoadUint64(&e.Counter) < 1 { 1084 m.t.Error("Expected call to DataSignerMock.GetSigningMethod") 1085 } 1086 } 1087 1088 // if default expectation was set then invocations count should be greater than zero 1089 if m.GetSigningMethodMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterGetSigningMethodCounter) < 1 { 1090 m.t.Error("Expected call to DataSignerMock.GetSigningMethod") 1091 } 1092 // if func was set then invocations count should be greater than zero 1093 if m.funcGetSigningMethod != nil && mm_atomic.LoadUint64(&m.afterGetSigningMethodCounter) < 1 { 1094 m.t.Error("Expected call to DataSignerMock.GetSigningMethod") 1095 } 1096 } 1097 1098 type mDataSignerMockNewHasher struct { 1099 mock *DataSignerMock 1100 defaultExpectation *DataSignerMockNewHasherExpectation 1101 expectations []*DataSignerMockNewHasherExpectation 1102 } 1103 1104 // DataSignerMockNewHasherExpectation specifies expectation struct of the DataSigner.NewHasher 1105 type DataSignerMockNewHasherExpectation struct { 1106 mock *DataSignerMock 1107 1108 results *DataSignerMockNewHasherResults 1109 Counter uint64 1110 } 1111 1112 // DataSignerMockNewHasherResults contains results of the DataSigner.NewHasher 1113 type DataSignerMockNewHasherResults struct { 1114 d1 DigestHasher 1115 } 1116 1117 // Expect sets up expected params for DataSigner.NewHasher 1118 func (mmNewHasher *mDataSignerMockNewHasher) Expect() *mDataSignerMockNewHasher { 1119 if mmNewHasher.mock.funcNewHasher != nil { 1120 mmNewHasher.mock.t.Fatalf("DataSignerMock.NewHasher mock is already set by Set") 1121 } 1122 1123 if mmNewHasher.defaultExpectation == nil { 1124 mmNewHasher.defaultExpectation = &DataSignerMockNewHasherExpectation{} 1125 } 1126 1127 return mmNewHasher 1128 } 1129 1130 // Inspect accepts an inspector function that has same arguments as the DataSigner.NewHasher 1131 func (mmNewHasher *mDataSignerMockNewHasher) Inspect(f func()) *mDataSignerMockNewHasher { 1132 if mmNewHasher.mock.inspectFuncNewHasher != nil { 1133 mmNewHasher.mock.t.Fatalf("Inspect function is already set for DataSignerMock.NewHasher") 1134 } 1135 1136 mmNewHasher.mock.inspectFuncNewHasher = f 1137 1138 return mmNewHasher 1139 } 1140 1141 // Return sets up results that will be returned by DataSigner.NewHasher 1142 func (mmNewHasher *mDataSignerMockNewHasher) Return(d1 DigestHasher) *DataSignerMock { 1143 if mmNewHasher.mock.funcNewHasher != nil { 1144 mmNewHasher.mock.t.Fatalf("DataSignerMock.NewHasher mock is already set by Set") 1145 } 1146 1147 if mmNewHasher.defaultExpectation == nil { 1148 mmNewHasher.defaultExpectation = &DataSignerMockNewHasherExpectation{mock: mmNewHasher.mock} 1149 } 1150 mmNewHasher.defaultExpectation.results = &DataSignerMockNewHasherResults{d1} 1151 return mmNewHasher.mock 1152 } 1153 1154 //Set uses given function f to mock the DataSigner.NewHasher method 1155 func (mmNewHasher *mDataSignerMockNewHasher) Set(f func() (d1 DigestHasher)) *DataSignerMock { 1156 if mmNewHasher.defaultExpectation != nil { 1157 mmNewHasher.mock.t.Fatalf("Default expectation is already set for the DataSigner.NewHasher method") 1158 } 1159 1160 if len(mmNewHasher.expectations) > 0 { 1161 mmNewHasher.mock.t.Fatalf("Some expectations are already set for the DataSigner.NewHasher method") 1162 } 1163 1164 mmNewHasher.mock.funcNewHasher = f 1165 return mmNewHasher.mock 1166 } 1167 1168 // NewHasher implements DataSigner 1169 func (mmNewHasher *DataSignerMock) NewHasher() (d1 DigestHasher) { 1170 mm_atomic.AddUint64(&mmNewHasher.beforeNewHasherCounter, 1) 1171 defer mm_atomic.AddUint64(&mmNewHasher.afterNewHasherCounter, 1) 1172 1173 if mmNewHasher.inspectFuncNewHasher != nil { 1174 mmNewHasher.inspectFuncNewHasher() 1175 } 1176 1177 if mmNewHasher.NewHasherMock.defaultExpectation != nil { 1178 mm_atomic.AddUint64(&mmNewHasher.NewHasherMock.defaultExpectation.Counter, 1) 1179 1180 mm_results := mmNewHasher.NewHasherMock.defaultExpectation.results 1181 if mm_results == nil { 1182 mmNewHasher.t.Fatal("No results are set for the DataSignerMock.NewHasher") 1183 } 1184 return (*mm_results).d1 1185 } 1186 if mmNewHasher.funcNewHasher != nil { 1187 return mmNewHasher.funcNewHasher() 1188 } 1189 mmNewHasher.t.Fatalf("Unexpected call to DataSignerMock.NewHasher.") 1190 return 1191 } 1192 1193 // NewHasherAfterCounter returns a count of finished DataSignerMock.NewHasher invocations 1194 func (mmNewHasher *DataSignerMock) NewHasherAfterCounter() uint64 { 1195 return mm_atomic.LoadUint64(&mmNewHasher.afterNewHasherCounter) 1196 } 1197 1198 // NewHasherBeforeCounter returns a count of DataSignerMock.NewHasher invocations 1199 func (mmNewHasher *DataSignerMock) NewHasherBeforeCounter() uint64 { 1200 return mm_atomic.LoadUint64(&mmNewHasher.beforeNewHasherCounter) 1201 } 1202 1203 // MinimockNewHasherDone returns true if the count of the NewHasher invocations corresponds 1204 // the number of defined expectations 1205 func (m *DataSignerMock) MinimockNewHasherDone() bool { 1206 for _, e := range m.NewHasherMock.expectations { 1207 if mm_atomic.LoadUint64(&e.Counter) < 1 { 1208 return false 1209 } 1210 } 1211 1212 // if default expectation was set then invocations count should be greater than zero 1213 if m.NewHasherMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterNewHasherCounter) < 1 { 1214 return false 1215 } 1216 // if func was set then invocations count should be greater than zero 1217 if m.funcNewHasher != nil && mm_atomic.LoadUint64(&m.afterNewHasherCounter) < 1 { 1218 return false 1219 } 1220 return true 1221 } 1222 1223 // MinimockNewHasherInspect logs each unmet expectation 1224 func (m *DataSignerMock) MinimockNewHasherInspect() { 1225 for _, e := range m.NewHasherMock.expectations { 1226 if mm_atomic.LoadUint64(&e.Counter) < 1 { 1227 m.t.Error("Expected call to DataSignerMock.NewHasher") 1228 } 1229 } 1230 1231 // if default expectation was set then invocations count should be greater than zero 1232 if m.NewHasherMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterNewHasherCounter) < 1 { 1233 m.t.Error("Expected call to DataSignerMock.NewHasher") 1234 } 1235 // if func was set then invocations count should be greater than zero 1236 if m.funcNewHasher != nil && mm_atomic.LoadUint64(&m.afterNewHasherCounter) < 1 { 1237 m.t.Error("Expected call to DataSignerMock.NewHasher") 1238 } 1239 } 1240 1241 type mDataSignerMockSignDigest struct { 1242 mock *DataSignerMock 1243 defaultExpectation *DataSignerMockSignDigestExpectation 1244 expectations []*DataSignerMockSignDigestExpectation 1245 1246 callArgs []*DataSignerMockSignDigestParams 1247 mutex sync.RWMutex 1248 } 1249 1250 // DataSignerMockSignDigestExpectation specifies expectation struct of the DataSigner.SignDigest 1251 type DataSignerMockSignDigestExpectation struct { 1252 mock *DataSignerMock 1253 params *DataSignerMockSignDigestParams 1254 results *DataSignerMockSignDigestResults 1255 Counter uint64 1256 } 1257 1258 // DataSignerMockSignDigestParams contains parameters of the DataSigner.SignDigest 1259 type DataSignerMockSignDigestParams struct { 1260 digest Digest 1261 } 1262 1263 // DataSignerMockSignDigestResults contains results of the DataSigner.SignDigest 1264 type DataSignerMockSignDigestResults struct { 1265 s1 Signature 1266 } 1267 1268 // Expect sets up expected params for DataSigner.SignDigest 1269 func (mmSignDigest *mDataSignerMockSignDigest) Expect(digest Digest) *mDataSignerMockSignDigest { 1270 if mmSignDigest.mock.funcSignDigest != nil { 1271 mmSignDigest.mock.t.Fatalf("DataSignerMock.SignDigest mock is already set by Set") 1272 } 1273 1274 if mmSignDigest.defaultExpectation == nil { 1275 mmSignDigest.defaultExpectation = &DataSignerMockSignDigestExpectation{} 1276 } 1277 1278 mmSignDigest.defaultExpectation.params = &DataSignerMockSignDigestParams{digest} 1279 for _, e := range mmSignDigest.expectations { 1280 if minimock.Equal(e.params, mmSignDigest.defaultExpectation.params) { 1281 mmSignDigest.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmSignDigest.defaultExpectation.params) 1282 } 1283 } 1284 1285 return mmSignDigest 1286 } 1287 1288 // Inspect accepts an inspector function that has same arguments as the DataSigner.SignDigest 1289 func (mmSignDigest *mDataSignerMockSignDigest) Inspect(f func(digest Digest)) *mDataSignerMockSignDigest { 1290 if mmSignDigest.mock.inspectFuncSignDigest != nil { 1291 mmSignDigest.mock.t.Fatalf("Inspect function is already set for DataSignerMock.SignDigest") 1292 } 1293 1294 mmSignDigest.mock.inspectFuncSignDigest = f 1295 1296 return mmSignDigest 1297 } 1298 1299 // Return sets up results that will be returned by DataSigner.SignDigest 1300 func (mmSignDigest *mDataSignerMockSignDigest) Return(s1 Signature) *DataSignerMock { 1301 if mmSignDigest.mock.funcSignDigest != nil { 1302 mmSignDigest.mock.t.Fatalf("DataSignerMock.SignDigest mock is already set by Set") 1303 } 1304 1305 if mmSignDigest.defaultExpectation == nil { 1306 mmSignDigest.defaultExpectation = &DataSignerMockSignDigestExpectation{mock: mmSignDigest.mock} 1307 } 1308 mmSignDigest.defaultExpectation.results = &DataSignerMockSignDigestResults{s1} 1309 return mmSignDigest.mock 1310 } 1311 1312 //Set uses given function f to mock the DataSigner.SignDigest method 1313 func (mmSignDigest *mDataSignerMockSignDigest) Set(f func(digest Digest) (s1 Signature)) *DataSignerMock { 1314 if mmSignDigest.defaultExpectation != nil { 1315 mmSignDigest.mock.t.Fatalf("Default expectation is already set for the DataSigner.SignDigest method") 1316 } 1317 1318 if len(mmSignDigest.expectations) > 0 { 1319 mmSignDigest.mock.t.Fatalf("Some expectations are already set for the DataSigner.SignDigest method") 1320 } 1321 1322 mmSignDigest.mock.funcSignDigest = f 1323 return mmSignDigest.mock 1324 } 1325 1326 // When sets expectation for the DataSigner.SignDigest which will trigger the result defined by the following 1327 // Then helper 1328 func (mmSignDigest *mDataSignerMockSignDigest) When(digest Digest) *DataSignerMockSignDigestExpectation { 1329 if mmSignDigest.mock.funcSignDigest != nil { 1330 mmSignDigest.mock.t.Fatalf("DataSignerMock.SignDigest mock is already set by Set") 1331 } 1332 1333 expectation := &DataSignerMockSignDigestExpectation{ 1334 mock: mmSignDigest.mock, 1335 params: &DataSignerMockSignDigestParams{digest}, 1336 } 1337 mmSignDigest.expectations = append(mmSignDigest.expectations, expectation) 1338 return expectation 1339 } 1340 1341 // Then sets up DataSigner.SignDigest return parameters for the expectation previously defined by the When method 1342 func (e *DataSignerMockSignDigestExpectation) Then(s1 Signature) *DataSignerMock { 1343 e.results = &DataSignerMockSignDigestResults{s1} 1344 return e.mock 1345 } 1346 1347 // SignDigest implements DataSigner 1348 func (mmSignDigest *DataSignerMock) SignDigest(digest Digest) (s1 Signature) { 1349 mm_atomic.AddUint64(&mmSignDigest.beforeSignDigestCounter, 1) 1350 defer mm_atomic.AddUint64(&mmSignDigest.afterSignDigestCounter, 1) 1351 1352 if mmSignDigest.inspectFuncSignDigest != nil { 1353 mmSignDigest.inspectFuncSignDigest(digest) 1354 } 1355 1356 mm_params := &DataSignerMockSignDigestParams{digest} 1357 1358 // Record call args 1359 mmSignDigest.SignDigestMock.mutex.Lock() 1360 mmSignDigest.SignDigestMock.callArgs = append(mmSignDigest.SignDigestMock.callArgs, mm_params) 1361 mmSignDigest.SignDigestMock.mutex.Unlock() 1362 1363 for _, e := range mmSignDigest.SignDigestMock.expectations { 1364 if minimock.Equal(e.params, mm_params) { 1365 mm_atomic.AddUint64(&e.Counter, 1) 1366 return e.results.s1 1367 } 1368 } 1369 1370 if mmSignDigest.SignDigestMock.defaultExpectation != nil { 1371 mm_atomic.AddUint64(&mmSignDigest.SignDigestMock.defaultExpectation.Counter, 1) 1372 mm_want := mmSignDigest.SignDigestMock.defaultExpectation.params 1373 mm_got := DataSignerMockSignDigestParams{digest} 1374 if mm_want != nil && !minimock.Equal(*mm_want, mm_got) { 1375 mmSignDigest.t.Errorf("DataSignerMock.SignDigest got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) 1376 } 1377 1378 mm_results := mmSignDigest.SignDigestMock.defaultExpectation.results 1379 if mm_results == nil { 1380 mmSignDigest.t.Fatal("No results are set for the DataSignerMock.SignDigest") 1381 } 1382 return (*mm_results).s1 1383 } 1384 if mmSignDigest.funcSignDigest != nil { 1385 return mmSignDigest.funcSignDigest(digest) 1386 } 1387 mmSignDigest.t.Fatalf("Unexpected call to DataSignerMock.SignDigest. %v", digest) 1388 return 1389 } 1390 1391 // SignDigestAfterCounter returns a count of finished DataSignerMock.SignDigest invocations 1392 func (mmSignDigest *DataSignerMock) SignDigestAfterCounter() uint64 { 1393 return mm_atomic.LoadUint64(&mmSignDigest.afterSignDigestCounter) 1394 } 1395 1396 // SignDigestBeforeCounter returns a count of DataSignerMock.SignDigest invocations 1397 func (mmSignDigest *DataSignerMock) SignDigestBeforeCounter() uint64 { 1398 return mm_atomic.LoadUint64(&mmSignDigest.beforeSignDigestCounter) 1399 } 1400 1401 // Calls returns a list of arguments used in each call to DataSignerMock.SignDigest. 1402 // The list is in the same order as the calls were made (i.e. recent calls have a higher index) 1403 func (mmSignDigest *mDataSignerMockSignDigest) Calls() []*DataSignerMockSignDigestParams { 1404 mmSignDigest.mutex.RLock() 1405 1406 argCopy := make([]*DataSignerMockSignDigestParams, len(mmSignDigest.callArgs)) 1407 copy(argCopy, mmSignDigest.callArgs) 1408 1409 mmSignDigest.mutex.RUnlock() 1410 1411 return argCopy 1412 } 1413 1414 // MinimockSignDigestDone returns true if the count of the SignDigest invocations corresponds 1415 // the number of defined expectations 1416 func (m *DataSignerMock) MinimockSignDigestDone() bool { 1417 for _, e := range m.SignDigestMock.expectations { 1418 if mm_atomic.LoadUint64(&e.Counter) < 1 { 1419 return false 1420 } 1421 } 1422 1423 // if default expectation was set then invocations count should be greater than zero 1424 if m.SignDigestMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterSignDigestCounter) < 1 { 1425 return false 1426 } 1427 // if func was set then invocations count should be greater than zero 1428 if m.funcSignDigest != nil && mm_atomic.LoadUint64(&m.afterSignDigestCounter) < 1 { 1429 return false 1430 } 1431 return true 1432 } 1433 1434 // MinimockSignDigestInspect logs each unmet expectation 1435 func (m *DataSignerMock) MinimockSignDigestInspect() { 1436 for _, e := range m.SignDigestMock.expectations { 1437 if mm_atomic.LoadUint64(&e.Counter) < 1 { 1438 m.t.Errorf("Expected call to DataSignerMock.SignDigest with params: %#v", *e.params) 1439 } 1440 } 1441 1442 // if default expectation was set then invocations count should be greater than zero 1443 if m.SignDigestMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterSignDigestCounter) < 1 { 1444 if m.SignDigestMock.defaultExpectation.params == nil { 1445 m.t.Error("Expected call to DataSignerMock.SignDigest") 1446 } else { 1447 m.t.Errorf("Expected call to DataSignerMock.SignDigest with params: %#v", *m.SignDigestMock.defaultExpectation.params) 1448 } 1449 } 1450 // if func was set then invocations count should be greater than zero 1451 if m.funcSignDigest != nil && mm_atomic.LoadUint64(&m.afterSignDigestCounter) < 1 { 1452 m.t.Error("Expected call to DataSignerMock.SignDigest") 1453 } 1454 } 1455 1456 // MinimockFinish checks that all mocked methods have been called the expected number of times 1457 func (m *DataSignerMock) MinimockFinish() { 1458 if !m.minimockDone() { 1459 m.MinimockDigestBytesInspect() 1460 1461 m.MinimockDigestDataInspect() 1462 1463 m.MinimockGetDigestMethodInspect() 1464 1465 m.MinimockGetDigestSizeInspect() 1466 1467 m.MinimockGetSignatureMethodInspect() 1468 1469 m.MinimockGetSigningMethodInspect() 1470 1471 m.MinimockNewHasherInspect() 1472 1473 m.MinimockSignDigestInspect() 1474 m.t.FailNow() 1475 } 1476 } 1477 1478 // MinimockWait waits for all mocked methods to be called the expected number of times 1479 func (m *DataSignerMock) MinimockWait(timeout mm_time.Duration) { 1480 timeoutCh := mm_time.After(timeout) 1481 for { 1482 if m.minimockDone() { 1483 return 1484 } 1485 select { 1486 case <-timeoutCh: 1487 m.MinimockFinish() 1488 return 1489 case <-mm_time.After(10 * mm_time.Millisecond): 1490 } 1491 } 1492 } 1493 1494 func (m *DataSignerMock) minimockDone() bool { 1495 done := true 1496 return done && 1497 m.MinimockDigestBytesDone() && 1498 m.MinimockDigestDataDone() && 1499 m.MinimockGetDigestMethodDone() && 1500 m.MinimockGetDigestSizeDone() && 1501 m.MinimockGetSignatureMethodDone() && 1502 m.MinimockGetSigningMethodDone() && 1503 m.MinimockNewHasherDone() && 1504 m.MinimockSignDigestDone() 1505 }