github.com/braveheart12/insolar-09-08-19@v0.8.7/testutils/network/unsync_list_mock.go (about) 1 package network 2 3 /* 4 DO NOT EDIT! 5 This code was generated automatically using github.com/gojuno/minimock v1.9 6 The original interface "UnsyncList" can be found in github.com/insolar/insolar/network 7 */ 8 import ( 9 "sync/atomic" 10 "time" 11 12 "github.com/gojuno/minimock" 13 packets "github.com/insolar/insolar/consensus/packets" 14 core "github.com/insolar/insolar/core" 15 network "github.com/insolar/insolar/network" 16 17 testify_assert "github.com/stretchr/testify/assert" 18 ) 19 20 //UnsyncListMock implements github.com/insolar/insolar/network.UnsyncList 21 type UnsyncListMock struct { 22 t minimock.Tester 23 24 AddClaimsFunc func(p map[core.RecordRef][]packets.ReferendumClaim) (r error) 25 AddClaimsCounter uint64 26 AddClaimsPreCounter uint64 27 AddClaimsMock mUnsyncListMockAddClaims 28 29 AddNodeFunc func(p core.Node, p1 uint16) 30 AddNodeCounter uint64 31 AddNodePreCounter uint64 32 AddNodeMock mUnsyncListMockAddNode 33 34 AddProofFunc func(p core.RecordRef, p1 *packets.NodePulseProof) 35 AddProofCounter uint64 36 AddProofPreCounter uint64 37 AddProofMock mUnsyncListMockAddProof 38 39 ApproveSyncFunc func(p []core.RecordRef) 40 ApproveSyncCounter uint64 41 ApproveSyncPreCounter uint64 42 ApproveSyncMock mUnsyncListMockApproveSync 43 44 CalculateHashFunc func(p core.PlatformCryptographyScheme) (r []byte, r1 error) 45 CalculateHashCounter uint64 46 CalculateHashPreCounter uint64 47 CalculateHashMock mUnsyncListMockCalculateHash 48 49 GetActiveNodeFunc func(p core.RecordRef) (r core.Node) 50 GetActiveNodeCounter uint64 51 GetActiveNodePreCounter uint64 52 GetActiveNodeMock mUnsyncListMockGetActiveNode 53 54 GetActiveNodesFunc func() (r []core.Node) 55 GetActiveNodesCounter uint64 56 GetActiveNodesPreCounter uint64 57 GetActiveNodesMock mUnsyncListMockGetActiveNodes 58 59 GetClaimsFunc func(p core.RecordRef) (r []packets.ReferendumClaim) 60 GetClaimsCounter uint64 61 GetClaimsPreCounter uint64 62 GetClaimsMock mUnsyncListMockGetClaims 63 64 GetGlobuleHashSignatureFunc func(p core.RecordRef) (r packets.GlobuleHashSignature, r1 bool) 65 GetGlobuleHashSignatureCounter uint64 66 GetGlobuleHashSignaturePreCounter uint64 67 GetGlobuleHashSignatureMock mUnsyncListMockGetGlobuleHashSignature 68 69 GetMergedCopyFunc func() (r *network.MergedListCopy, r1 error) 70 GetMergedCopyCounter uint64 71 GetMergedCopyPreCounter uint64 72 GetMergedCopyMock mUnsyncListMockGetMergedCopy 73 74 GetProofFunc func(p core.RecordRef) (r *packets.NodePulseProof) 75 GetProofCounter uint64 76 GetProofPreCounter uint64 77 GetProofMock mUnsyncListMockGetProof 78 79 IndexToRefFunc func(p int) (r core.RecordRef, r1 error) 80 IndexToRefCounter uint64 81 IndexToRefPreCounter uint64 82 IndexToRefMock mUnsyncListMockIndexToRef 83 84 LengthFunc func() (r int) 85 LengthCounter uint64 86 LengthPreCounter uint64 87 LengthMock mUnsyncListMockLength 88 89 RefToIndexFunc func(p core.RecordRef) (r int, r1 error) 90 RefToIndexCounter uint64 91 RefToIndexPreCounter uint64 92 RefToIndexMock mUnsyncListMockRefToIndex 93 94 RemoveNodeFunc func(p core.RecordRef) 95 RemoveNodeCounter uint64 96 RemoveNodePreCounter uint64 97 RemoveNodeMock mUnsyncListMockRemoveNode 98 99 SetGlobuleHashSignatureFunc func(p core.RecordRef, p1 packets.GlobuleHashSignature) 100 SetGlobuleHashSignatureCounter uint64 101 SetGlobuleHashSignaturePreCounter uint64 102 SetGlobuleHashSignatureMock mUnsyncListMockSetGlobuleHashSignature 103 } 104 105 //NewUnsyncListMock returns a mock for github.com/insolar/insolar/network.UnsyncList 106 func NewUnsyncListMock(t minimock.Tester) *UnsyncListMock { 107 m := &UnsyncListMock{t: t} 108 109 if controller, ok := t.(minimock.MockController); ok { 110 controller.RegisterMocker(m) 111 } 112 113 m.AddClaimsMock = mUnsyncListMockAddClaims{mock: m} 114 m.AddNodeMock = mUnsyncListMockAddNode{mock: m} 115 m.AddProofMock = mUnsyncListMockAddProof{mock: m} 116 m.ApproveSyncMock = mUnsyncListMockApproveSync{mock: m} 117 m.CalculateHashMock = mUnsyncListMockCalculateHash{mock: m} 118 m.GetActiveNodeMock = mUnsyncListMockGetActiveNode{mock: m} 119 m.GetActiveNodesMock = mUnsyncListMockGetActiveNodes{mock: m} 120 m.GetClaimsMock = mUnsyncListMockGetClaims{mock: m} 121 m.GetGlobuleHashSignatureMock = mUnsyncListMockGetGlobuleHashSignature{mock: m} 122 m.GetMergedCopyMock = mUnsyncListMockGetMergedCopy{mock: m} 123 m.GetProofMock = mUnsyncListMockGetProof{mock: m} 124 m.IndexToRefMock = mUnsyncListMockIndexToRef{mock: m} 125 m.LengthMock = mUnsyncListMockLength{mock: m} 126 m.RefToIndexMock = mUnsyncListMockRefToIndex{mock: m} 127 m.RemoveNodeMock = mUnsyncListMockRemoveNode{mock: m} 128 m.SetGlobuleHashSignatureMock = mUnsyncListMockSetGlobuleHashSignature{mock: m} 129 130 return m 131 } 132 133 type mUnsyncListMockAddClaims struct { 134 mock *UnsyncListMock 135 mainExpectation *UnsyncListMockAddClaimsExpectation 136 expectationSeries []*UnsyncListMockAddClaimsExpectation 137 } 138 139 type UnsyncListMockAddClaimsExpectation struct { 140 input *UnsyncListMockAddClaimsInput 141 result *UnsyncListMockAddClaimsResult 142 } 143 144 type UnsyncListMockAddClaimsInput struct { 145 p map[core.RecordRef][]packets.ReferendumClaim 146 } 147 148 type UnsyncListMockAddClaimsResult struct { 149 r error 150 } 151 152 //Expect specifies that invocation of UnsyncList.AddClaims is expected from 1 to Infinity times 153 func (m *mUnsyncListMockAddClaims) Expect(p map[core.RecordRef][]packets.ReferendumClaim) *mUnsyncListMockAddClaims { 154 m.mock.AddClaimsFunc = nil 155 m.expectationSeries = nil 156 157 if m.mainExpectation == nil { 158 m.mainExpectation = &UnsyncListMockAddClaimsExpectation{} 159 } 160 m.mainExpectation.input = &UnsyncListMockAddClaimsInput{p} 161 return m 162 } 163 164 //Return specifies results of invocation of UnsyncList.AddClaims 165 func (m *mUnsyncListMockAddClaims) Return(r error) *UnsyncListMock { 166 m.mock.AddClaimsFunc = nil 167 m.expectationSeries = nil 168 169 if m.mainExpectation == nil { 170 m.mainExpectation = &UnsyncListMockAddClaimsExpectation{} 171 } 172 m.mainExpectation.result = &UnsyncListMockAddClaimsResult{r} 173 return m.mock 174 } 175 176 //ExpectOnce specifies that invocation of UnsyncList.AddClaims is expected once 177 func (m *mUnsyncListMockAddClaims) ExpectOnce(p map[core.RecordRef][]packets.ReferendumClaim) *UnsyncListMockAddClaimsExpectation { 178 m.mock.AddClaimsFunc = nil 179 m.mainExpectation = nil 180 181 expectation := &UnsyncListMockAddClaimsExpectation{} 182 expectation.input = &UnsyncListMockAddClaimsInput{p} 183 m.expectationSeries = append(m.expectationSeries, expectation) 184 return expectation 185 } 186 187 func (e *UnsyncListMockAddClaimsExpectation) Return(r error) { 188 e.result = &UnsyncListMockAddClaimsResult{r} 189 } 190 191 //Set uses given function f as a mock of UnsyncList.AddClaims method 192 func (m *mUnsyncListMockAddClaims) Set(f func(p map[core.RecordRef][]packets.ReferendumClaim) (r error)) *UnsyncListMock { 193 m.mainExpectation = nil 194 m.expectationSeries = nil 195 196 m.mock.AddClaimsFunc = f 197 return m.mock 198 } 199 200 //AddClaims implements github.com/insolar/insolar/network.UnsyncList interface 201 func (m *UnsyncListMock) AddClaims(p map[core.RecordRef][]packets.ReferendumClaim) (r error) { 202 counter := atomic.AddUint64(&m.AddClaimsPreCounter, 1) 203 defer atomic.AddUint64(&m.AddClaimsCounter, 1) 204 205 if len(m.AddClaimsMock.expectationSeries) > 0 { 206 if counter > uint64(len(m.AddClaimsMock.expectationSeries)) { 207 m.t.Fatalf("Unexpected call to UnsyncListMock.AddClaims. %v", p) 208 return 209 } 210 211 input := m.AddClaimsMock.expectationSeries[counter-1].input 212 testify_assert.Equal(m.t, *input, UnsyncListMockAddClaimsInput{p}, "UnsyncList.AddClaims got unexpected parameters") 213 214 result := m.AddClaimsMock.expectationSeries[counter-1].result 215 if result == nil { 216 m.t.Fatal("No results are set for the UnsyncListMock.AddClaims") 217 return 218 } 219 220 r = result.r 221 222 return 223 } 224 225 if m.AddClaimsMock.mainExpectation != nil { 226 227 input := m.AddClaimsMock.mainExpectation.input 228 if input != nil { 229 testify_assert.Equal(m.t, *input, UnsyncListMockAddClaimsInput{p}, "UnsyncList.AddClaims got unexpected parameters") 230 } 231 232 result := m.AddClaimsMock.mainExpectation.result 233 if result == nil { 234 m.t.Fatal("No results are set for the UnsyncListMock.AddClaims") 235 } 236 237 r = result.r 238 239 return 240 } 241 242 if m.AddClaimsFunc == nil { 243 m.t.Fatalf("Unexpected call to UnsyncListMock.AddClaims. %v", p) 244 return 245 } 246 247 return m.AddClaimsFunc(p) 248 } 249 250 //AddClaimsMinimockCounter returns a count of UnsyncListMock.AddClaimsFunc invocations 251 func (m *UnsyncListMock) AddClaimsMinimockCounter() uint64 { 252 return atomic.LoadUint64(&m.AddClaimsCounter) 253 } 254 255 //AddClaimsMinimockPreCounter returns the value of UnsyncListMock.AddClaims invocations 256 func (m *UnsyncListMock) AddClaimsMinimockPreCounter() uint64 { 257 return atomic.LoadUint64(&m.AddClaimsPreCounter) 258 } 259 260 //AddClaimsFinished returns true if mock invocations count is ok 261 func (m *UnsyncListMock) AddClaimsFinished() bool { 262 // if expectation series were set then invocations count should be equal to expectations count 263 if len(m.AddClaimsMock.expectationSeries) > 0 { 264 return atomic.LoadUint64(&m.AddClaimsCounter) == uint64(len(m.AddClaimsMock.expectationSeries)) 265 } 266 267 // if main expectation was set then invocations count should be greater than zero 268 if m.AddClaimsMock.mainExpectation != nil { 269 return atomic.LoadUint64(&m.AddClaimsCounter) > 0 270 } 271 272 // if func was set then invocations count should be greater than zero 273 if m.AddClaimsFunc != nil { 274 return atomic.LoadUint64(&m.AddClaimsCounter) > 0 275 } 276 277 return true 278 } 279 280 type mUnsyncListMockAddNode struct { 281 mock *UnsyncListMock 282 mainExpectation *UnsyncListMockAddNodeExpectation 283 expectationSeries []*UnsyncListMockAddNodeExpectation 284 } 285 286 type UnsyncListMockAddNodeExpectation struct { 287 input *UnsyncListMockAddNodeInput 288 } 289 290 type UnsyncListMockAddNodeInput struct { 291 p core.Node 292 p1 uint16 293 } 294 295 //Expect specifies that invocation of UnsyncList.AddNode is expected from 1 to Infinity times 296 func (m *mUnsyncListMockAddNode) Expect(p core.Node, p1 uint16) *mUnsyncListMockAddNode { 297 m.mock.AddNodeFunc = nil 298 m.expectationSeries = nil 299 300 if m.mainExpectation == nil { 301 m.mainExpectation = &UnsyncListMockAddNodeExpectation{} 302 } 303 m.mainExpectation.input = &UnsyncListMockAddNodeInput{p, p1} 304 return m 305 } 306 307 //Return specifies results of invocation of UnsyncList.AddNode 308 func (m *mUnsyncListMockAddNode) Return() *UnsyncListMock { 309 m.mock.AddNodeFunc = nil 310 m.expectationSeries = nil 311 312 if m.mainExpectation == nil { 313 m.mainExpectation = &UnsyncListMockAddNodeExpectation{} 314 } 315 316 return m.mock 317 } 318 319 //ExpectOnce specifies that invocation of UnsyncList.AddNode is expected once 320 func (m *mUnsyncListMockAddNode) ExpectOnce(p core.Node, p1 uint16) *UnsyncListMockAddNodeExpectation { 321 m.mock.AddNodeFunc = nil 322 m.mainExpectation = nil 323 324 expectation := &UnsyncListMockAddNodeExpectation{} 325 expectation.input = &UnsyncListMockAddNodeInput{p, p1} 326 m.expectationSeries = append(m.expectationSeries, expectation) 327 return expectation 328 } 329 330 //Set uses given function f as a mock of UnsyncList.AddNode method 331 func (m *mUnsyncListMockAddNode) Set(f func(p core.Node, p1 uint16)) *UnsyncListMock { 332 m.mainExpectation = nil 333 m.expectationSeries = nil 334 335 m.mock.AddNodeFunc = f 336 return m.mock 337 } 338 339 //AddNode implements github.com/insolar/insolar/network.UnsyncList interface 340 func (m *UnsyncListMock) AddNode(p core.Node, p1 uint16) { 341 counter := atomic.AddUint64(&m.AddNodePreCounter, 1) 342 defer atomic.AddUint64(&m.AddNodeCounter, 1) 343 344 if len(m.AddNodeMock.expectationSeries) > 0 { 345 if counter > uint64(len(m.AddNodeMock.expectationSeries)) { 346 m.t.Fatalf("Unexpected call to UnsyncListMock.AddNode. %v %v", p, p1) 347 return 348 } 349 350 input := m.AddNodeMock.expectationSeries[counter-1].input 351 testify_assert.Equal(m.t, *input, UnsyncListMockAddNodeInput{p, p1}, "UnsyncList.AddNode got unexpected parameters") 352 353 return 354 } 355 356 if m.AddNodeMock.mainExpectation != nil { 357 358 input := m.AddNodeMock.mainExpectation.input 359 if input != nil { 360 testify_assert.Equal(m.t, *input, UnsyncListMockAddNodeInput{p, p1}, "UnsyncList.AddNode got unexpected parameters") 361 } 362 363 return 364 } 365 366 if m.AddNodeFunc == nil { 367 m.t.Fatalf("Unexpected call to UnsyncListMock.AddNode. %v %v", p, p1) 368 return 369 } 370 371 m.AddNodeFunc(p, p1) 372 } 373 374 //AddNodeMinimockCounter returns a count of UnsyncListMock.AddNodeFunc invocations 375 func (m *UnsyncListMock) AddNodeMinimockCounter() uint64 { 376 return atomic.LoadUint64(&m.AddNodeCounter) 377 } 378 379 //AddNodeMinimockPreCounter returns the value of UnsyncListMock.AddNode invocations 380 func (m *UnsyncListMock) AddNodeMinimockPreCounter() uint64 { 381 return atomic.LoadUint64(&m.AddNodePreCounter) 382 } 383 384 //AddNodeFinished returns true if mock invocations count is ok 385 func (m *UnsyncListMock) AddNodeFinished() bool { 386 // if expectation series were set then invocations count should be equal to expectations count 387 if len(m.AddNodeMock.expectationSeries) > 0 { 388 return atomic.LoadUint64(&m.AddNodeCounter) == uint64(len(m.AddNodeMock.expectationSeries)) 389 } 390 391 // if main expectation was set then invocations count should be greater than zero 392 if m.AddNodeMock.mainExpectation != nil { 393 return atomic.LoadUint64(&m.AddNodeCounter) > 0 394 } 395 396 // if func was set then invocations count should be greater than zero 397 if m.AddNodeFunc != nil { 398 return atomic.LoadUint64(&m.AddNodeCounter) > 0 399 } 400 401 return true 402 } 403 404 type mUnsyncListMockAddProof struct { 405 mock *UnsyncListMock 406 mainExpectation *UnsyncListMockAddProofExpectation 407 expectationSeries []*UnsyncListMockAddProofExpectation 408 } 409 410 type UnsyncListMockAddProofExpectation struct { 411 input *UnsyncListMockAddProofInput 412 } 413 414 type UnsyncListMockAddProofInput struct { 415 p core.RecordRef 416 p1 *packets.NodePulseProof 417 } 418 419 //Expect specifies that invocation of UnsyncList.AddProof is expected from 1 to Infinity times 420 func (m *mUnsyncListMockAddProof) Expect(p core.RecordRef, p1 *packets.NodePulseProof) *mUnsyncListMockAddProof { 421 m.mock.AddProofFunc = nil 422 m.expectationSeries = nil 423 424 if m.mainExpectation == nil { 425 m.mainExpectation = &UnsyncListMockAddProofExpectation{} 426 } 427 m.mainExpectation.input = &UnsyncListMockAddProofInput{p, p1} 428 return m 429 } 430 431 //Return specifies results of invocation of UnsyncList.AddProof 432 func (m *mUnsyncListMockAddProof) Return() *UnsyncListMock { 433 m.mock.AddProofFunc = nil 434 m.expectationSeries = nil 435 436 if m.mainExpectation == nil { 437 m.mainExpectation = &UnsyncListMockAddProofExpectation{} 438 } 439 440 return m.mock 441 } 442 443 //ExpectOnce specifies that invocation of UnsyncList.AddProof is expected once 444 func (m *mUnsyncListMockAddProof) ExpectOnce(p core.RecordRef, p1 *packets.NodePulseProof) *UnsyncListMockAddProofExpectation { 445 m.mock.AddProofFunc = nil 446 m.mainExpectation = nil 447 448 expectation := &UnsyncListMockAddProofExpectation{} 449 expectation.input = &UnsyncListMockAddProofInput{p, p1} 450 m.expectationSeries = append(m.expectationSeries, expectation) 451 return expectation 452 } 453 454 //Set uses given function f as a mock of UnsyncList.AddProof method 455 func (m *mUnsyncListMockAddProof) Set(f func(p core.RecordRef, p1 *packets.NodePulseProof)) *UnsyncListMock { 456 m.mainExpectation = nil 457 m.expectationSeries = nil 458 459 m.mock.AddProofFunc = f 460 return m.mock 461 } 462 463 //AddProof implements github.com/insolar/insolar/network.UnsyncList interface 464 func (m *UnsyncListMock) AddProof(p core.RecordRef, p1 *packets.NodePulseProof) { 465 counter := atomic.AddUint64(&m.AddProofPreCounter, 1) 466 defer atomic.AddUint64(&m.AddProofCounter, 1) 467 468 if len(m.AddProofMock.expectationSeries) > 0 { 469 if counter > uint64(len(m.AddProofMock.expectationSeries)) { 470 m.t.Fatalf("Unexpected call to UnsyncListMock.AddProof. %v %v", p, p1) 471 return 472 } 473 474 input := m.AddProofMock.expectationSeries[counter-1].input 475 testify_assert.Equal(m.t, *input, UnsyncListMockAddProofInput{p, p1}, "UnsyncList.AddProof got unexpected parameters") 476 477 return 478 } 479 480 if m.AddProofMock.mainExpectation != nil { 481 482 input := m.AddProofMock.mainExpectation.input 483 if input != nil { 484 testify_assert.Equal(m.t, *input, UnsyncListMockAddProofInput{p, p1}, "UnsyncList.AddProof got unexpected parameters") 485 } 486 487 return 488 } 489 490 if m.AddProofFunc == nil { 491 m.t.Fatalf("Unexpected call to UnsyncListMock.AddProof. %v %v", p, p1) 492 return 493 } 494 495 m.AddProofFunc(p, p1) 496 } 497 498 //AddProofMinimockCounter returns a count of UnsyncListMock.AddProofFunc invocations 499 func (m *UnsyncListMock) AddProofMinimockCounter() uint64 { 500 return atomic.LoadUint64(&m.AddProofCounter) 501 } 502 503 //AddProofMinimockPreCounter returns the value of UnsyncListMock.AddProof invocations 504 func (m *UnsyncListMock) AddProofMinimockPreCounter() uint64 { 505 return atomic.LoadUint64(&m.AddProofPreCounter) 506 } 507 508 //AddProofFinished returns true if mock invocations count is ok 509 func (m *UnsyncListMock) AddProofFinished() bool { 510 // if expectation series were set then invocations count should be equal to expectations count 511 if len(m.AddProofMock.expectationSeries) > 0 { 512 return atomic.LoadUint64(&m.AddProofCounter) == uint64(len(m.AddProofMock.expectationSeries)) 513 } 514 515 // if main expectation was set then invocations count should be greater than zero 516 if m.AddProofMock.mainExpectation != nil { 517 return atomic.LoadUint64(&m.AddProofCounter) > 0 518 } 519 520 // if func was set then invocations count should be greater than zero 521 if m.AddProofFunc != nil { 522 return atomic.LoadUint64(&m.AddProofCounter) > 0 523 } 524 525 return true 526 } 527 528 type mUnsyncListMockApproveSync struct { 529 mock *UnsyncListMock 530 mainExpectation *UnsyncListMockApproveSyncExpectation 531 expectationSeries []*UnsyncListMockApproveSyncExpectation 532 } 533 534 type UnsyncListMockApproveSyncExpectation struct { 535 input *UnsyncListMockApproveSyncInput 536 } 537 538 type UnsyncListMockApproveSyncInput struct { 539 p []core.RecordRef 540 } 541 542 //Expect specifies that invocation of UnsyncList.ApproveSync is expected from 1 to Infinity times 543 func (m *mUnsyncListMockApproveSync) Expect(p []core.RecordRef) *mUnsyncListMockApproveSync { 544 m.mock.ApproveSyncFunc = nil 545 m.expectationSeries = nil 546 547 if m.mainExpectation == nil { 548 m.mainExpectation = &UnsyncListMockApproveSyncExpectation{} 549 } 550 m.mainExpectation.input = &UnsyncListMockApproveSyncInput{p} 551 return m 552 } 553 554 //Return specifies results of invocation of UnsyncList.ApproveSync 555 func (m *mUnsyncListMockApproveSync) Return() *UnsyncListMock { 556 m.mock.ApproveSyncFunc = nil 557 m.expectationSeries = nil 558 559 if m.mainExpectation == nil { 560 m.mainExpectation = &UnsyncListMockApproveSyncExpectation{} 561 } 562 563 return m.mock 564 } 565 566 //ExpectOnce specifies that invocation of UnsyncList.ApproveSync is expected once 567 func (m *mUnsyncListMockApproveSync) ExpectOnce(p []core.RecordRef) *UnsyncListMockApproveSyncExpectation { 568 m.mock.ApproveSyncFunc = nil 569 m.mainExpectation = nil 570 571 expectation := &UnsyncListMockApproveSyncExpectation{} 572 expectation.input = &UnsyncListMockApproveSyncInput{p} 573 m.expectationSeries = append(m.expectationSeries, expectation) 574 return expectation 575 } 576 577 //Set uses given function f as a mock of UnsyncList.ApproveSync method 578 func (m *mUnsyncListMockApproveSync) Set(f func(p []core.RecordRef)) *UnsyncListMock { 579 m.mainExpectation = nil 580 m.expectationSeries = nil 581 582 m.mock.ApproveSyncFunc = f 583 return m.mock 584 } 585 586 //ApproveSync implements github.com/insolar/insolar/network.UnsyncList interface 587 func (m *UnsyncListMock) ApproveSync(p []core.RecordRef) { 588 counter := atomic.AddUint64(&m.ApproveSyncPreCounter, 1) 589 defer atomic.AddUint64(&m.ApproveSyncCounter, 1) 590 591 if len(m.ApproveSyncMock.expectationSeries) > 0 { 592 if counter > uint64(len(m.ApproveSyncMock.expectationSeries)) { 593 m.t.Fatalf("Unexpected call to UnsyncListMock.ApproveSync. %v", p) 594 return 595 } 596 597 input := m.ApproveSyncMock.expectationSeries[counter-1].input 598 testify_assert.Equal(m.t, *input, UnsyncListMockApproveSyncInput{p}, "UnsyncList.ApproveSync got unexpected parameters") 599 600 return 601 } 602 603 if m.ApproveSyncMock.mainExpectation != nil { 604 605 input := m.ApproveSyncMock.mainExpectation.input 606 if input != nil { 607 testify_assert.Equal(m.t, *input, UnsyncListMockApproveSyncInput{p}, "UnsyncList.ApproveSync got unexpected parameters") 608 } 609 610 return 611 } 612 613 if m.ApproveSyncFunc == nil { 614 m.t.Fatalf("Unexpected call to UnsyncListMock.ApproveSync. %v", p) 615 return 616 } 617 618 m.ApproveSyncFunc(p) 619 } 620 621 //ApproveSyncMinimockCounter returns a count of UnsyncListMock.ApproveSyncFunc invocations 622 func (m *UnsyncListMock) ApproveSyncMinimockCounter() uint64 { 623 return atomic.LoadUint64(&m.ApproveSyncCounter) 624 } 625 626 //ApproveSyncMinimockPreCounter returns the value of UnsyncListMock.ApproveSync invocations 627 func (m *UnsyncListMock) ApproveSyncMinimockPreCounter() uint64 { 628 return atomic.LoadUint64(&m.ApproveSyncPreCounter) 629 } 630 631 //ApproveSyncFinished returns true if mock invocations count is ok 632 func (m *UnsyncListMock) ApproveSyncFinished() bool { 633 // if expectation series were set then invocations count should be equal to expectations count 634 if len(m.ApproveSyncMock.expectationSeries) > 0 { 635 return atomic.LoadUint64(&m.ApproveSyncCounter) == uint64(len(m.ApproveSyncMock.expectationSeries)) 636 } 637 638 // if main expectation was set then invocations count should be greater than zero 639 if m.ApproveSyncMock.mainExpectation != nil { 640 return atomic.LoadUint64(&m.ApproveSyncCounter) > 0 641 } 642 643 // if func was set then invocations count should be greater than zero 644 if m.ApproveSyncFunc != nil { 645 return atomic.LoadUint64(&m.ApproveSyncCounter) > 0 646 } 647 648 return true 649 } 650 651 type mUnsyncListMockCalculateHash struct { 652 mock *UnsyncListMock 653 mainExpectation *UnsyncListMockCalculateHashExpectation 654 expectationSeries []*UnsyncListMockCalculateHashExpectation 655 } 656 657 type UnsyncListMockCalculateHashExpectation struct { 658 input *UnsyncListMockCalculateHashInput 659 result *UnsyncListMockCalculateHashResult 660 } 661 662 type UnsyncListMockCalculateHashInput struct { 663 p core.PlatformCryptographyScheme 664 } 665 666 type UnsyncListMockCalculateHashResult struct { 667 r []byte 668 r1 error 669 } 670 671 //Expect specifies that invocation of UnsyncList.CalculateHash is expected from 1 to Infinity times 672 func (m *mUnsyncListMockCalculateHash) Expect(p core.PlatformCryptographyScheme) *mUnsyncListMockCalculateHash { 673 m.mock.CalculateHashFunc = nil 674 m.expectationSeries = nil 675 676 if m.mainExpectation == nil { 677 m.mainExpectation = &UnsyncListMockCalculateHashExpectation{} 678 } 679 m.mainExpectation.input = &UnsyncListMockCalculateHashInput{p} 680 return m 681 } 682 683 //Return specifies results of invocation of UnsyncList.CalculateHash 684 func (m *mUnsyncListMockCalculateHash) Return(r []byte, r1 error) *UnsyncListMock { 685 m.mock.CalculateHashFunc = nil 686 m.expectationSeries = nil 687 688 if m.mainExpectation == nil { 689 m.mainExpectation = &UnsyncListMockCalculateHashExpectation{} 690 } 691 m.mainExpectation.result = &UnsyncListMockCalculateHashResult{r, r1} 692 return m.mock 693 } 694 695 //ExpectOnce specifies that invocation of UnsyncList.CalculateHash is expected once 696 func (m *mUnsyncListMockCalculateHash) ExpectOnce(p core.PlatformCryptographyScheme) *UnsyncListMockCalculateHashExpectation { 697 m.mock.CalculateHashFunc = nil 698 m.mainExpectation = nil 699 700 expectation := &UnsyncListMockCalculateHashExpectation{} 701 expectation.input = &UnsyncListMockCalculateHashInput{p} 702 m.expectationSeries = append(m.expectationSeries, expectation) 703 return expectation 704 } 705 706 func (e *UnsyncListMockCalculateHashExpectation) Return(r []byte, r1 error) { 707 e.result = &UnsyncListMockCalculateHashResult{r, r1} 708 } 709 710 //Set uses given function f as a mock of UnsyncList.CalculateHash method 711 func (m *mUnsyncListMockCalculateHash) Set(f func(p core.PlatformCryptographyScheme) (r []byte, r1 error)) *UnsyncListMock { 712 m.mainExpectation = nil 713 m.expectationSeries = nil 714 715 m.mock.CalculateHashFunc = f 716 return m.mock 717 } 718 719 //CalculateHash implements github.com/insolar/insolar/network.UnsyncList interface 720 func (m *UnsyncListMock) CalculateHash(p core.PlatformCryptographyScheme) (r []byte, r1 error) { 721 counter := atomic.AddUint64(&m.CalculateHashPreCounter, 1) 722 defer atomic.AddUint64(&m.CalculateHashCounter, 1) 723 724 if len(m.CalculateHashMock.expectationSeries) > 0 { 725 if counter > uint64(len(m.CalculateHashMock.expectationSeries)) { 726 m.t.Fatalf("Unexpected call to UnsyncListMock.CalculateHash. %v", p) 727 return 728 } 729 730 input := m.CalculateHashMock.expectationSeries[counter-1].input 731 testify_assert.Equal(m.t, *input, UnsyncListMockCalculateHashInput{p}, "UnsyncList.CalculateHash got unexpected parameters") 732 733 result := m.CalculateHashMock.expectationSeries[counter-1].result 734 if result == nil { 735 m.t.Fatal("No results are set for the UnsyncListMock.CalculateHash") 736 return 737 } 738 739 r = result.r 740 r1 = result.r1 741 742 return 743 } 744 745 if m.CalculateHashMock.mainExpectation != nil { 746 747 input := m.CalculateHashMock.mainExpectation.input 748 if input != nil { 749 testify_assert.Equal(m.t, *input, UnsyncListMockCalculateHashInput{p}, "UnsyncList.CalculateHash got unexpected parameters") 750 } 751 752 result := m.CalculateHashMock.mainExpectation.result 753 if result == nil { 754 m.t.Fatal("No results are set for the UnsyncListMock.CalculateHash") 755 } 756 757 r = result.r 758 r1 = result.r1 759 760 return 761 } 762 763 if m.CalculateHashFunc == nil { 764 m.t.Fatalf("Unexpected call to UnsyncListMock.CalculateHash. %v", p) 765 return 766 } 767 768 return m.CalculateHashFunc(p) 769 } 770 771 //CalculateHashMinimockCounter returns a count of UnsyncListMock.CalculateHashFunc invocations 772 func (m *UnsyncListMock) CalculateHashMinimockCounter() uint64 { 773 return atomic.LoadUint64(&m.CalculateHashCounter) 774 } 775 776 //CalculateHashMinimockPreCounter returns the value of UnsyncListMock.CalculateHash invocations 777 func (m *UnsyncListMock) CalculateHashMinimockPreCounter() uint64 { 778 return atomic.LoadUint64(&m.CalculateHashPreCounter) 779 } 780 781 //CalculateHashFinished returns true if mock invocations count is ok 782 func (m *UnsyncListMock) CalculateHashFinished() bool { 783 // if expectation series were set then invocations count should be equal to expectations count 784 if len(m.CalculateHashMock.expectationSeries) > 0 { 785 return atomic.LoadUint64(&m.CalculateHashCounter) == uint64(len(m.CalculateHashMock.expectationSeries)) 786 } 787 788 // if main expectation was set then invocations count should be greater than zero 789 if m.CalculateHashMock.mainExpectation != nil { 790 return atomic.LoadUint64(&m.CalculateHashCounter) > 0 791 } 792 793 // if func was set then invocations count should be greater than zero 794 if m.CalculateHashFunc != nil { 795 return atomic.LoadUint64(&m.CalculateHashCounter) > 0 796 } 797 798 return true 799 } 800 801 type mUnsyncListMockGetActiveNode struct { 802 mock *UnsyncListMock 803 mainExpectation *UnsyncListMockGetActiveNodeExpectation 804 expectationSeries []*UnsyncListMockGetActiveNodeExpectation 805 } 806 807 type UnsyncListMockGetActiveNodeExpectation struct { 808 input *UnsyncListMockGetActiveNodeInput 809 result *UnsyncListMockGetActiveNodeResult 810 } 811 812 type UnsyncListMockGetActiveNodeInput struct { 813 p core.RecordRef 814 } 815 816 type UnsyncListMockGetActiveNodeResult struct { 817 r core.Node 818 } 819 820 //Expect specifies that invocation of UnsyncList.GetActiveNode is expected from 1 to Infinity times 821 func (m *mUnsyncListMockGetActiveNode) Expect(p core.RecordRef) *mUnsyncListMockGetActiveNode { 822 m.mock.GetActiveNodeFunc = nil 823 m.expectationSeries = nil 824 825 if m.mainExpectation == nil { 826 m.mainExpectation = &UnsyncListMockGetActiveNodeExpectation{} 827 } 828 m.mainExpectation.input = &UnsyncListMockGetActiveNodeInput{p} 829 return m 830 } 831 832 //Return specifies results of invocation of UnsyncList.GetActiveNode 833 func (m *mUnsyncListMockGetActiveNode) Return(r core.Node) *UnsyncListMock { 834 m.mock.GetActiveNodeFunc = nil 835 m.expectationSeries = nil 836 837 if m.mainExpectation == nil { 838 m.mainExpectation = &UnsyncListMockGetActiveNodeExpectation{} 839 } 840 m.mainExpectation.result = &UnsyncListMockGetActiveNodeResult{r} 841 return m.mock 842 } 843 844 //ExpectOnce specifies that invocation of UnsyncList.GetActiveNode is expected once 845 func (m *mUnsyncListMockGetActiveNode) ExpectOnce(p core.RecordRef) *UnsyncListMockGetActiveNodeExpectation { 846 m.mock.GetActiveNodeFunc = nil 847 m.mainExpectation = nil 848 849 expectation := &UnsyncListMockGetActiveNodeExpectation{} 850 expectation.input = &UnsyncListMockGetActiveNodeInput{p} 851 m.expectationSeries = append(m.expectationSeries, expectation) 852 return expectation 853 } 854 855 func (e *UnsyncListMockGetActiveNodeExpectation) Return(r core.Node) { 856 e.result = &UnsyncListMockGetActiveNodeResult{r} 857 } 858 859 //Set uses given function f as a mock of UnsyncList.GetActiveNode method 860 func (m *mUnsyncListMockGetActiveNode) Set(f func(p core.RecordRef) (r core.Node)) *UnsyncListMock { 861 m.mainExpectation = nil 862 m.expectationSeries = nil 863 864 m.mock.GetActiveNodeFunc = f 865 return m.mock 866 } 867 868 //GetActiveNode implements github.com/insolar/insolar/network.UnsyncList interface 869 func (m *UnsyncListMock) GetActiveNode(p core.RecordRef) (r core.Node) { 870 counter := atomic.AddUint64(&m.GetActiveNodePreCounter, 1) 871 defer atomic.AddUint64(&m.GetActiveNodeCounter, 1) 872 873 if len(m.GetActiveNodeMock.expectationSeries) > 0 { 874 if counter > uint64(len(m.GetActiveNodeMock.expectationSeries)) { 875 m.t.Fatalf("Unexpected call to UnsyncListMock.GetActiveNode. %v", p) 876 return 877 } 878 879 input := m.GetActiveNodeMock.expectationSeries[counter-1].input 880 testify_assert.Equal(m.t, *input, UnsyncListMockGetActiveNodeInput{p}, "UnsyncList.GetActiveNode got unexpected parameters") 881 882 result := m.GetActiveNodeMock.expectationSeries[counter-1].result 883 if result == nil { 884 m.t.Fatal("No results are set for the UnsyncListMock.GetActiveNode") 885 return 886 } 887 888 r = result.r 889 890 return 891 } 892 893 if m.GetActiveNodeMock.mainExpectation != nil { 894 895 input := m.GetActiveNodeMock.mainExpectation.input 896 if input != nil { 897 testify_assert.Equal(m.t, *input, UnsyncListMockGetActiveNodeInput{p}, "UnsyncList.GetActiveNode got unexpected parameters") 898 } 899 900 result := m.GetActiveNodeMock.mainExpectation.result 901 if result == nil { 902 m.t.Fatal("No results are set for the UnsyncListMock.GetActiveNode") 903 } 904 905 r = result.r 906 907 return 908 } 909 910 if m.GetActiveNodeFunc == nil { 911 m.t.Fatalf("Unexpected call to UnsyncListMock.GetActiveNode. %v", p) 912 return 913 } 914 915 return m.GetActiveNodeFunc(p) 916 } 917 918 //GetActiveNodeMinimockCounter returns a count of UnsyncListMock.GetActiveNodeFunc invocations 919 func (m *UnsyncListMock) GetActiveNodeMinimockCounter() uint64 { 920 return atomic.LoadUint64(&m.GetActiveNodeCounter) 921 } 922 923 //GetActiveNodeMinimockPreCounter returns the value of UnsyncListMock.GetActiveNode invocations 924 func (m *UnsyncListMock) GetActiveNodeMinimockPreCounter() uint64 { 925 return atomic.LoadUint64(&m.GetActiveNodePreCounter) 926 } 927 928 //GetActiveNodeFinished returns true if mock invocations count is ok 929 func (m *UnsyncListMock) GetActiveNodeFinished() bool { 930 // if expectation series were set then invocations count should be equal to expectations count 931 if len(m.GetActiveNodeMock.expectationSeries) > 0 { 932 return atomic.LoadUint64(&m.GetActiveNodeCounter) == uint64(len(m.GetActiveNodeMock.expectationSeries)) 933 } 934 935 // if main expectation was set then invocations count should be greater than zero 936 if m.GetActiveNodeMock.mainExpectation != nil { 937 return atomic.LoadUint64(&m.GetActiveNodeCounter) > 0 938 } 939 940 // if func was set then invocations count should be greater than zero 941 if m.GetActiveNodeFunc != nil { 942 return atomic.LoadUint64(&m.GetActiveNodeCounter) > 0 943 } 944 945 return true 946 } 947 948 type mUnsyncListMockGetActiveNodes struct { 949 mock *UnsyncListMock 950 mainExpectation *UnsyncListMockGetActiveNodesExpectation 951 expectationSeries []*UnsyncListMockGetActiveNodesExpectation 952 } 953 954 type UnsyncListMockGetActiveNodesExpectation struct { 955 result *UnsyncListMockGetActiveNodesResult 956 } 957 958 type UnsyncListMockGetActiveNodesResult struct { 959 r []core.Node 960 } 961 962 //Expect specifies that invocation of UnsyncList.GetActiveNodes is expected from 1 to Infinity times 963 func (m *mUnsyncListMockGetActiveNodes) Expect() *mUnsyncListMockGetActiveNodes { 964 m.mock.GetActiveNodesFunc = nil 965 m.expectationSeries = nil 966 967 if m.mainExpectation == nil { 968 m.mainExpectation = &UnsyncListMockGetActiveNodesExpectation{} 969 } 970 971 return m 972 } 973 974 //Return specifies results of invocation of UnsyncList.GetActiveNodes 975 func (m *mUnsyncListMockGetActiveNodes) Return(r []core.Node) *UnsyncListMock { 976 m.mock.GetActiveNodesFunc = nil 977 m.expectationSeries = nil 978 979 if m.mainExpectation == nil { 980 m.mainExpectation = &UnsyncListMockGetActiveNodesExpectation{} 981 } 982 m.mainExpectation.result = &UnsyncListMockGetActiveNodesResult{r} 983 return m.mock 984 } 985 986 //ExpectOnce specifies that invocation of UnsyncList.GetActiveNodes is expected once 987 func (m *mUnsyncListMockGetActiveNodes) ExpectOnce() *UnsyncListMockGetActiveNodesExpectation { 988 m.mock.GetActiveNodesFunc = nil 989 m.mainExpectation = nil 990 991 expectation := &UnsyncListMockGetActiveNodesExpectation{} 992 993 m.expectationSeries = append(m.expectationSeries, expectation) 994 return expectation 995 } 996 997 func (e *UnsyncListMockGetActiveNodesExpectation) Return(r []core.Node) { 998 e.result = &UnsyncListMockGetActiveNodesResult{r} 999 } 1000 1001 //Set uses given function f as a mock of UnsyncList.GetActiveNodes method 1002 func (m *mUnsyncListMockGetActiveNodes) Set(f func() (r []core.Node)) *UnsyncListMock { 1003 m.mainExpectation = nil 1004 m.expectationSeries = nil 1005 1006 m.mock.GetActiveNodesFunc = f 1007 return m.mock 1008 } 1009 1010 //GetActiveNodes implements github.com/insolar/insolar/network.UnsyncList interface 1011 func (m *UnsyncListMock) GetActiveNodes() (r []core.Node) { 1012 counter := atomic.AddUint64(&m.GetActiveNodesPreCounter, 1) 1013 defer atomic.AddUint64(&m.GetActiveNodesCounter, 1) 1014 1015 if len(m.GetActiveNodesMock.expectationSeries) > 0 { 1016 if counter > uint64(len(m.GetActiveNodesMock.expectationSeries)) { 1017 m.t.Fatalf("Unexpected call to UnsyncListMock.GetActiveNodes.") 1018 return 1019 } 1020 1021 result := m.GetActiveNodesMock.expectationSeries[counter-1].result 1022 if result == nil { 1023 m.t.Fatal("No results are set for the UnsyncListMock.GetActiveNodes") 1024 return 1025 } 1026 1027 r = result.r 1028 1029 return 1030 } 1031 1032 if m.GetActiveNodesMock.mainExpectation != nil { 1033 1034 result := m.GetActiveNodesMock.mainExpectation.result 1035 if result == nil { 1036 m.t.Fatal("No results are set for the UnsyncListMock.GetActiveNodes") 1037 } 1038 1039 r = result.r 1040 1041 return 1042 } 1043 1044 if m.GetActiveNodesFunc == nil { 1045 m.t.Fatalf("Unexpected call to UnsyncListMock.GetActiveNodes.") 1046 return 1047 } 1048 1049 return m.GetActiveNodesFunc() 1050 } 1051 1052 //GetActiveNodesMinimockCounter returns a count of UnsyncListMock.GetActiveNodesFunc invocations 1053 func (m *UnsyncListMock) GetActiveNodesMinimockCounter() uint64 { 1054 return atomic.LoadUint64(&m.GetActiveNodesCounter) 1055 } 1056 1057 //GetActiveNodesMinimockPreCounter returns the value of UnsyncListMock.GetActiveNodes invocations 1058 func (m *UnsyncListMock) GetActiveNodesMinimockPreCounter() uint64 { 1059 return atomic.LoadUint64(&m.GetActiveNodesPreCounter) 1060 } 1061 1062 //GetActiveNodesFinished returns true if mock invocations count is ok 1063 func (m *UnsyncListMock) GetActiveNodesFinished() bool { 1064 // if expectation series were set then invocations count should be equal to expectations count 1065 if len(m.GetActiveNodesMock.expectationSeries) > 0 { 1066 return atomic.LoadUint64(&m.GetActiveNodesCounter) == uint64(len(m.GetActiveNodesMock.expectationSeries)) 1067 } 1068 1069 // if main expectation was set then invocations count should be greater than zero 1070 if m.GetActiveNodesMock.mainExpectation != nil { 1071 return atomic.LoadUint64(&m.GetActiveNodesCounter) > 0 1072 } 1073 1074 // if func was set then invocations count should be greater than zero 1075 if m.GetActiveNodesFunc != nil { 1076 return atomic.LoadUint64(&m.GetActiveNodesCounter) > 0 1077 } 1078 1079 return true 1080 } 1081 1082 type mUnsyncListMockGetClaims struct { 1083 mock *UnsyncListMock 1084 mainExpectation *UnsyncListMockGetClaimsExpectation 1085 expectationSeries []*UnsyncListMockGetClaimsExpectation 1086 } 1087 1088 type UnsyncListMockGetClaimsExpectation struct { 1089 input *UnsyncListMockGetClaimsInput 1090 result *UnsyncListMockGetClaimsResult 1091 } 1092 1093 type UnsyncListMockGetClaimsInput struct { 1094 p core.RecordRef 1095 } 1096 1097 type UnsyncListMockGetClaimsResult struct { 1098 r []packets.ReferendumClaim 1099 } 1100 1101 //Expect specifies that invocation of UnsyncList.GetClaims is expected from 1 to Infinity times 1102 func (m *mUnsyncListMockGetClaims) Expect(p core.RecordRef) *mUnsyncListMockGetClaims { 1103 m.mock.GetClaimsFunc = nil 1104 m.expectationSeries = nil 1105 1106 if m.mainExpectation == nil { 1107 m.mainExpectation = &UnsyncListMockGetClaimsExpectation{} 1108 } 1109 m.mainExpectation.input = &UnsyncListMockGetClaimsInput{p} 1110 return m 1111 } 1112 1113 //Return specifies results of invocation of UnsyncList.GetClaims 1114 func (m *mUnsyncListMockGetClaims) Return(r []packets.ReferendumClaim) *UnsyncListMock { 1115 m.mock.GetClaimsFunc = nil 1116 m.expectationSeries = nil 1117 1118 if m.mainExpectation == nil { 1119 m.mainExpectation = &UnsyncListMockGetClaimsExpectation{} 1120 } 1121 m.mainExpectation.result = &UnsyncListMockGetClaimsResult{r} 1122 return m.mock 1123 } 1124 1125 //ExpectOnce specifies that invocation of UnsyncList.GetClaims is expected once 1126 func (m *mUnsyncListMockGetClaims) ExpectOnce(p core.RecordRef) *UnsyncListMockGetClaimsExpectation { 1127 m.mock.GetClaimsFunc = nil 1128 m.mainExpectation = nil 1129 1130 expectation := &UnsyncListMockGetClaimsExpectation{} 1131 expectation.input = &UnsyncListMockGetClaimsInput{p} 1132 m.expectationSeries = append(m.expectationSeries, expectation) 1133 return expectation 1134 } 1135 1136 func (e *UnsyncListMockGetClaimsExpectation) Return(r []packets.ReferendumClaim) { 1137 e.result = &UnsyncListMockGetClaimsResult{r} 1138 } 1139 1140 //Set uses given function f as a mock of UnsyncList.GetClaims method 1141 func (m *mUnsyncListMockGetClaims) Set(f func(p core.RecordRef) (r []packets.ReferendumClaim)) *UnsyncListMock { 1142 m.mainExpectation = nil 1143 m.expectationSeries = nil 1144 1145 m.mock.GetClaimsFunc = f 1146 return m.mock 1147 } 1148 1149 //GetClaims implements github.com/insolar/insolar/network.UnsyncList interface 1150 func (m *UnsyncListMock) GetClaims(p core.RecordRef) (r []packets.ReferendumClaim) { 1151 counter := atomic.AddUint64(&m.GetClaimsPreCounter, 1) 1152 defer atomic.AddUint64(&m.GetClaimsCounter, 1) 1153 1154 if len(m.GetClaimsMock.expectationSeries) > 0 { 1155 if counter > uint64(len(m.GetClaimsMock.expectationSeries)) { 1156 m.t.Fatalf("Unexpected call to UnsyncListMock.GetClaims. %v", p) 1157 return 1158 } 1159 1160 input := m.GetClaimsMock.expectationSeries[counter-1].input 1161 testify_assert.Equal(m.t, *input, UnsyncListMockGetClaimsInput{p}, "UnsyncList.GetClaims got unexpected parameters") 1162 1163 result := m.GetClaimsMock.expectationSeries[counter-1].result 1164 if result == nil { 1165 m.t.Fatal("No results are set for the UnsyncListMock.GetClaims") 1166 return 1167 } 1168 1169 r = result.r 1170 1171 return 1172 } 1173 1174 if m.GetClaimsMock.mainExpectation != nil { 1175 1176 input := m.GetClaimsMock.mainExpectation.input 1177 if input != nil { 1178 testify_assert.Equal(m.t, *input, UnsyncListMockGetClaimsInput{p}, "UnsyncList.GetClaims got unexpected parameters") 1179 } 1180 1181 result := m.GetClaimsMock.mainExpectation.result 1182 if result == nil { 1183 m.t.Fatal("No results are set for the UnsyncListMock.GetClaims") 1184 } 1185 1186 r = result.r 1187 1188 return 1189 } 1190 1191 if m.GetClaimsFunc == nil { 1192 m.t.Fatalf("Unexpected call to UnsyncListMock.GetClaims. %v", p) 1193 return 1194 } 1195 1196 return m.GetClaimsFunc(p) 1197 } 1198 1199 //GetClaimsMinimockCounter returns a count of UnsyncListMock.GetClaimsFunc invocations 1200 func (m *UnsyncListMock) GetClaimsMinimockCounter() uint64 { 1201 return atomic.LoadUint64(&m.GetClaimsCounter) 1202 } 1203 1204 //GetClaimsMinimockPreCounter returns the value of UnsyncListMock.GetClaims invocations 1205 func (m *UnsyncListMock) GetClaimsMinimockPreCounter() uint64 { 1206 return atomic.LoadUint64(&m.GetClaimsPreCounter) 1207 } 1208 1209 //GetClaimsFinished returns true if mock invocations count is ok 1210 func (m *UnsyncListMock) GetClaimsFinished() bool { 1211 // if expectation series were set then invocations count should be equal to expectations count 1212 if len(m.GetClaimsMock.expectationSeries) > 0 { 1213 return atomic.LoadUint64(&m.GetClaimsCounter) == uint64(len(m.GetClaimsMock.expectationSeries)) 1214 } 1215 1216 // if main expectation was set then invocations count should be greater than zero 1217 if m.GetClaimsMock.mainExpectation != nil { 1218 return atomic.LoadUint64(&m.GetClaimsCounter) > 0 1219 } 1220 1221 // if func was set then invocations count should be greater than zero 1222 if m.GetClaimsFunc != nil { 1223 return atomic.LoadUint64(&m.GetClaimsCounter) > 0 1224 } 1225 1226 return true 1227 } 1228 1229 type mUnsyncListMockGetGlobuleHashSignature struct { 1230 mock *UnsyncListMock 1231 mainExpectation *UnsyncListMockGetGlobuleHashSignatureExpectation 1232 expectationSeries []*UnsyncListMockGetGlobuleHashSignatureExpectation 1233 } 1234 1235 type UnsyncListMockGetGlobuleHashSignatureExpectation struct { 1236 input *UnsyncListMockGetGlobuleHashSignatureInput 1237 result *UnsyncListMockGetGlobuleHashSignatureResult 1238 } 1239 1240 type UnsyncListMockGetGlobuleHashSignatureInput struct { 1241 p core.RecordRef 1242 } 1243 1244 type UnsyncListMockGetGlobuleHashSignatureResult struct { 1245 r packets.GlobuleHashSignature 1246 r1 bool 1247 } 1248 1249 //Expect specifies that invocation of UnsyncList.GetGlobuleHashSignature is expected from 1 to Infinity times 1250 func (m *mUnsyncListMockGetGlobuleHashSignature) Expect(p core.RecordRef) *mUnsyncListMockGetGlobuleHashSignature { 1251 m.mock.GetGlobuleHashSignatureFunc = nil 1252 m.expectationSeries = nil 1253 1254 if m.mainExpectation == nil { 1255 m.mainExpectation = &UnsyncListMockGetGlobuleHashSignatureExpectation{} 1256 } 1257 m.mainExpectation.input = &UnsyncListMockGetGlobuleHashSignatureInput{p} 1258 return m 1259 } 1260 1261 //Return specifies results of invocation of UnsyncList.GetGlobuleHashSignature 1262 func (m *mUnsyncListMockGetGlobuleHashSignature) Return(r packets.GlobuleHashSignature, r1 bool) *UnsyncListMock { 1263 m.mock.GetGlobuleHashSignatureFunc = nil 1264 m.expectationSeries = nil 1265 1266 if m.mainExpectation == nil { 1267 m.mainExpectation = &UnsyncListMockGetGlobuleHashSignatureExpectation{} 1268 } 1269 m.mainExpectation.result = &UnsyncListMockGetGlobuleHashSignatureResult{r, r1} 1270 return m.mock 1271 } 1272 1273 //ExpectOnce specifies that invocation of UnsyncList.GetGlobuleHashSignature is expected once 1274 func (m *mUnsyncListMockGetGlobuleHashSignature) ExpectOnce(p core.RecordRef) *UnsyncListMockGetGlobuleHashSignatureExpectation { 1275 m.mock.GetGlobuleHashSignatureFunc = nil 1276 m.mainExpectation = nil 1277 1278 expectation := &UnsyncListMockGetGlobuleHashSignatureExpectation{} 1279 expectation.input = &UnsyncListMockGetGlobuleHashSignatureInput{p} 1280 m.expectationSeries = append(m.expectationSeries, expectation) 1281 return expectation 1282 } 1283 1284 func (e *UnsyncListMockGetGlobuleHashSignatureExpectation) Return(r packets.GlobuleHashSignature, r1 bool) { 1285 e.result = &UnsyncListMockGetGlobuleHashSignatureResult{r, r1} 1286 } 1287 1288 //Set uses given function f as a mock of UnsyncList.GetGlobuleHashSignature method 1289 func (m *mUnsyncListMockGetGlobuleHashSignature) Set(f func(p core.RecordRef) (r packets.GlobuleHashSignature, r1 bool)) *UnsyncListMock { 1290 m.mainExpectation = nil 1291 m.expectationSeries = nil 1292 1293 m.mock.GetGlobuleHashSignatureFunc = f 1294 return m.mock 1295 } 1296 1297 //GetGlobuleHashSignature implements github.com/insolar/insolar/network.UnsyncList interface 1298 func (m *UnsyncListMock) GetGlobuleHashSignature(p core.RecordRef) (r packets.GlobuleHashSignature, r1 bool) { 1299 counter := atomic.AddUint64(&m.GetGlobuleHashSignaturePreCounter, 1) 1300 defer atomic.AddUint64(&m.GetGlobuleHashSignatureCounter, 1) 1301 1302 if len(m.GetGlobuleHashSignatureMock.expectationSeries) > 0 { 1303 if counter > uint64(len(m.GetGlobuleHashSignatureMock.expectationSeries)) { 1304 m.t.Fatalf("Unexpected call to UnsyncListMock.GetGlobuleHashSignature. %v", p) 1305 return 1306 } 1307 1308 input := m.GetGlobuleHashSignatureMock.expectationSeries[counter-1].input 1309 testify_assert.Equal(m.t, *input, UnsyncListMockGetGlobuleHashSignatureInput{p}, "UnsyncList.GetGlobuleHashSignature got unexpected parameters") 1310 1311 result := m.GetGlobuleHashSignatureMock.expectationSeries[counter-1].result 1312 if result == nil { 1313 m.t.Fatal("No results are set for the UnsyncListMock.GetGlobuleHashSignature") 1314 return 1315 } 1316 1317 r = result.r 1318 r1 = result.r1 1319 1320 return 1321 } 1322 1323 if m.GetGlobuleHashSignatureMock.mainExpectation != nil { 1324 1325 input := m.GetGlobuleHashSignatureMock.mainExpectation.input 1326 if input != nil { 1327 testify_assert.Equal(m.t, *input, UnsyncListMockGetGlobuleHashSignatureInput{p}, "UnsyncList.GetGlobuleHashSignature got unexpected parameters") 1328 } 1329 1330 result := m.GetGlobuleHashSignatureMock.mainExpectation.result 1331 if result == nil { 1332 m.t.Fatal("No results are set for the UnsyncListMock.GetGlobuleHashSignature") 1333 } 1334 1335 r = result.r 1336 r1 = result.r1 1337 1338 return 1339 } 1340 1341 if m.GetGlobuleHashSignatureFunc == nil { 1342 m.t.Fatalf("Unexpected call to UnsyncListMock.GetGlobuleHashSignature. %v", p) 1343 return 1344 } 1345 1346 return m.GetGlobuleHashSignatureFunc(p) 1347 } 1348 1349 //GetGlobuleHashSignatureMinimockCounter returns a count of UnsyncListMock.GetGlobuleHashSignatureFunc invocations 1350 func (m *UnsyncListMock) GetGlobuleHashSignatureMinimockCounter() uint64 { 1351 return atomic.LoadUint64(&m.GetGlobuleHashSignatureCounter) 1352 } 1353 1354 //GetGlobuleHashSignatureMinimockPreCounter returns the value of UnsyncListMock.GetGlobuleHashSignature invocations 1355 func (m *UnsyncListMock) GetGlobuleHashSignatureMinimockPreCounter() uint64 { 1356 return atomic.LoadUint64(&m.GetGlobuleHashSignaturePreCounter) 1357 } 1358 1359 //GetGlobuleHashSignatureFinished returns true if mock invocations count is ok 1360 func (m *UnsyncListMock) GetGlobuleHashSignatureFinished() bool { 1361 // if expectation series were set then invocations count should be equal to expectations count 1362 if len(m.GetGlobuleHashSignatureMock.expectationSeries) > 0 { 1363 return atomic.LoadUint64(&m.GetGlobuleHashSignatureCounter) == uint64(len(m.GetGlobuleHashSignatureMock.expectationSeries)) 1364 } 1365 1366 // if main expectation was set then invocations count should be greater than zero 1367 if m.GetGlobuleHashSignatureMock.mainExpectation != nil { 1368 return atomic.LoadUint64(&m.GetGlobuleHashSignatureCounter) > 0 1369 } 1370 1371 // if func was set then invocations count should be greater than zero 1372 if m.GetGlobuleHashSignatureFunc != nil { 1373 return atomic.LoadUint64(&m.GetGlobuleHashSignatureCounter) > 0 1374 } 1375 1376 return true 1377 } 1378 1379 type mUnsyncListMockGetMergedCopy struct { 1380 mock *UnsyncListMock 1381 mainExpectation *UnsyncListMockGetMergedCopyExpectation 1382 expectationSeries []*UnsyncListMockGetMergedCopyExpectation 1383 } 1384 1385 type UnsyncListMockGetMergedCopyExpectation struct { 1386 result *UnsyncListMockGetMergedCopyResult 1387 } 1388 1389 type UnsyncListMockGetMergedCopyResult struct { 1390 r *network.MergedListCopy 1391 r1 error 1392 } 1393 1394 //Expect specifies that invocation of UnsyncList.GetMergedCopy is expected from 1 to Infinity times 1395 func (m *mUnsyncListMockGetMergedCopy) Expect() *mUnsyncListMockGetMergedCopy { 1396 m.mock.GetMergedCopyFunc = nil 1397 m.expectationSeries = nil 1398 1399 if m.mainExpectation == nil { 1400 m.mainExpectation = &UnsyncListMockGetMergedCopyExpectation{} 1401 } 1402 1403 return m 1404 } 1405 1406 //Return specifies results of invocation of UnsyncList.GetMergedCopy 1407 func (m *mUnsyncListMockGetMergedCopy) Return(r *network.MergedListCopy, r1 error) *UnsyncListMock { 1408 m.mock.GetMergedCopyFunc = nil 1409 m.expectationSeries = nil 1410 1411 if m.mainExpectation == nil { 1412 m.mainExpectation = &UnsyncListMockGetMergedCopyExpectation{} 1413 } 1414 m.mainExpectation.result = &UnsyncListMockGetMergedCopyResult{r, r1} 1415 return m.mock 1416 } 1417 1418 //ExpectOnce specifies that invocation of UnsyncList.GetMergedCopy is expected once 1419 func (m *mUnsyncListMockGetMergedCopy) ExpectOnce() *UnsyncListMockGetMergedCopyExpectation { 1420 m.mock.GetMergedCopyFunc = nil 1421 m.mainExpectation = nil 1422 1423 expectation := &UnsyncListMockGetMergedCopyExpectation{} 1424 1425 m.expectationSeries = append(m.expectationSeries, expectation) 1426 return expectation 1427 } 1428 1429 func (e *UnsyncListMockGetMergedCopyExpectation) Return(r *network.MergedListCopy, r1 error) { 1430 e.result = &UnsyncListMockGetMergedCopyResult{r, r1} 1431 } 1432 1433 //Set uses given function f as a mock of UnsyncList.GetMergedCopy method 1434 func (m *mUnsyncListMockGetMergedCopy) Set(f func() (r *network.MergedListCopy, r1 error)) *UnsyncListMock { 1435 m.mainExpectation = nil 1436 m.expectationSeries = nil 1437 1438 m.mock.GetMergedCopyFunc = f 1439 return m.mock 1440 } 1441 1442 //GetMergedCopy implements github.com/insolar/insolar/network.UnsyncList interface 1443 func (m *UnsyncListMock) GetMergedCopy() (r *network.MergedListCopy, r1 error) { 1444 counter := atomic.AddUint64(&m.GetMergedCopyPreCounter, 1) 1445 defer atomic.AddUint64(&m.GetMergedCopyCounter, 1) 1446 1447 if len(m.GetMergedCopyMock.expectationSeries) > 0 { 1448 if counter > uint64(len(m.GetMergedCopyMock.expectationSeries)) { 1449 m.t.Fatalf("Unexpected call to UnsyncListMock.GetMergedCopy.") 1450 return 1451 } 1452 1453 result := m.GetMergedCopyMock.expectationSeries[counter-1].result 1454 if result == nil { 1455 m.t.Fatal("No results are set for the UnsyncListMock.GetMergedCopy") 1456 return 1457 } 1458 1459 r = result.r 1460 r1 = result.r1 1461 1462 return 1463 } 1464 1465 if m.GetMergedCopyMock.mainExpectation != nil { 1466 1467 result := m.GetMergedCopyMock.mainExpectation.result 1468 if result == nil { 1469 m.t.Fatal("No results are set for the UnsyncListMock.GetMergedCopy") 1470 } 1471 1472 r = result.r 1473 r1 = result.r1 1474 1475 return 1476 } 1477 1478 if m.GetMergedCopyFunc == nil { 1479 m.t.Fatalf("Unexpected call to UnsyncListMock.GetMergedCopy.") 1480 return 1481 } 1482 1483 return m.GetMergedCopyFunc() 1484 } 1485 1486 //GetMergedCopyMinimockCounter returns a count of UnsyncListMock.GetMergedCopyFunc invocations 1487 func (m *UnsyncListMock) GetMergedCopyMinimockCounter() uint64 { 1488 return atomic.LoadUint64(&m.GetMergedCopyCounter) 1489 } 1490 1491 //GetMergedCopyMinimockPreCounter returns the value of UnsyncListMock.GetMergedCopy invocations 1492 func (m *UnsyncListMock) GetMergedCopyMinimockPreCounter() uint64 { 1493 return atomic.LoadUint64(&m.GetMergedCopyPreCounter) 1494 } 1495 1496 //GetMergedCopyFinished returns true if mock invocations count is ok 1497 func (m *UnsyncListMock) GetMergedCopyFinished() bool { 1498 // if expectation series were set then invocations count should be equal to expectations count 1499 if len(m.GetMergedCopyMock.expectationSeries) > 0 { 1500 return atomic.LoadUint64(&m.GetMergedCopyCounter) == uint64(len(m.GetMergedCopyMock.expectationSeries)) 1501 } 1502 1503 // if main expectation was set then invocations count should be greater than zero 1504 if m.GetMergedCopyMock.mainExpectation != nil { 1505 return atomic.LoadUint64(&m.GetMergedCopyCounter) > 0 1506 } 1507 1508 // if func was set then invocations count should be greater than zero 1509 if m.GetMergedCopyFunc != nil { 1510 return atomic.LoadUint64(&m.GetMergedCopyCounter) > 0 1511 } 1512 1513 return true 1514 } 1515 1516 type mUnsyncListMockGetProof struct { 1517 mock *UnsyncListMock 1518 mainExpectation *UnsyncListMockGetProofExpectation 1519 expectationSeries []*UnsyncListMockGetProofExpectation 1520 } 1521 1522 type UnsyncListMockGetProofExpectation struct { 1523 input *UnsyncListMockGetProofInput 1524 result *UnsyncListMockGetProofResult 1525 } 1526 1527 type UnsyncListMockGetProofInput struct { 1528 p core.RecordRef 1529 } 1530 1531 type UnsyncListMockGetProofResult struct { 1532 r *packets.NodePulseProof 1533 } 1534 1535 //Expect specifies that invocation of UnsyncList.GetProof is expected from 1 to Infinity times 1536 func (m *mUnsyncListMockGetProof) Expect(p core.RecordRef) *mUnsyncListMockGetProof { 1537 m.mock.GetProofFunc = nil 1538 m.expectationSeries = nil 1539 1540 if m.mainExpectation == nil { 1541 m.mainExpectation = &UnsyncListMockGetProofExpectation{} 1542 } 1543 m.mainExpectation.input = &UnsyncListMockGetProofInput{p} 1544 return m 1545 } 1546 1547 //Return specifies results of invocation of UnsyncList.GetProof 1548 func (m *mUnsyncListMockGetProof) Return(r *packets.NodePulseProof) *UnsyncListMock { 1549 m.mock.GetProofFunc = nil 1550 m.expectationSeries = nil 1551 1552 if m.mainExpectation == nil { 1553 m.mainExpectation = &UnsyncListMockGetProofExpectation{} 1554 } 1555 m.mainExpectation.result = &UnsyncListMockGetProofResult{r} 1556 return m.mock 1557 } 1558 1559 //ExpectOnce specifies that invocation of UnsyncList.GetProof is expected once 1560 func (m *mUnsyncListMockGetProof) ExpectOnce(p core.RecordRef) *UnsyncListMockGetProofExpectation { 1561 m.mock.GetProofFunc = nil 1562 m.mainExpectation = nil 1563 1564 expectation := &UnsyncListMockGetProofExpectation{} 1565 expectation.input = &UnsyncListMockGetProofInput{p} 1566 m.expectationSeries = append(m.expectationSeries, expectation) 1567 return expectation 1568 } 1569 1570 func (e *UnsyncListMockGetProofExpectation) Return(r *packets.NodePulseProof) { 1571 e.result = &UnsyncListMockGetProofResult{r} 1572 } 1573 1574 //Set uses given function f as a mock of UnsyncList.GetProof method 1575 func (m *mUnsyncListMockGetProof) Set(f func(p core.RecordRef) (r *packets.NodePulseProof)) *UnsyncListMock { 1576 m.mainExpectation = nil 1577 m.expectationSeries = nil 1578 1579 m.mock.GetProofFunc = f 1580 return m.mock 1581 } 1582 1583 //GetProof implements github.com/insolar/insolar/network.UnsyncList interface 1584 func (m *UnsyncListMock) GetProof(p core.RecordRef) (r *packets.NodePulseProof) { 1585 counter := atomic.AddUint64(&m.GetProofPreCounter, 1) 1586 defer atomic.AddUint64(&m.GetProofCounter, 1) 1587 1588 if len(m.GetProofMock.expectationSeries) > 0 { 1589 if counter > uint64(len(m.GetProofMock.expectationSeries)) { 1590 m.t.Fatalf("Unexpected call to UnsyncListMock.GetProof. %v", p) 1591 return 1592 } 1593 1594 input := m.GetProofMock.expectationSeries[counter-1].input 1595 testify_assert.Equal(m.t, *input, UnsyncListMockGetProofInput{p}, "UnsyncList.GetProof got unexpected parameters") 1596 1597 result := m.GetProofMock.expectationSeries[counter-1].result 1598 if result == nil { 1599 m.t.Fatal("No results are set for the UnsyncListMock.GetProof") 1600 return 1601 } 1602 1603 r = result.r 1604 1605 return 1606 } 1607 1608 if m.GetProofMock.mainExpectation != nil { 1609 1610 input := m.GetProofMock.mainExpectation.input 1611 if input != nil { 1612 testify_assert.Equal(m.t, *input, UnsyncListMockGetProofInput{p}, "UnsyncList.GetProof got unexpected parameters") 1613 } 1614 1615 result := m.GetProofMock.mainExpectation.result 1616 if result == nil { 1617 m.t.Fatal("No results are set for the UnsyncListMock.GetProof") 1618 } 1619 1620 r = result.r 1621 1622 return 1623 } 1624 1625 if m.GetProofFunc == nil { 1626 m.t.Fatalf("Unexpected call to UnsyncListMock.GetProof. %v", p) 1627 return 1628 } 1629 1630 return m.GetProofFunc(p) 1631 } 1632 1633 //GetProofMinimockCounter returns a count of UnsyncListMock.GetProofFunc invocations 1634 func (m *UnsyncListMock) GetProofMinimockCounter() uint64 { 1635 return atomic.LoadUint64(&m.GetProofCounter) 1636 } 1637 1638 //GetProofMinimockPreCounter returns the value of UnsyncListMock.GetProof invocations 1639 func (m *UnsyncListMock) GetProofMinimockPreCounter() uint64 { 1640 return atomic.LoadUint64(&m.GetProofPreCounter) 1641 } 1642 1643 //GetProofFinished returns true if mock invocations count is ok 1644 func (m *UnsyncListMock) GetProofFinished() bool { 1645 // if expectation series were set then invocations count should be equal to expectations count 1646 if len(m.GetProofMock.expectationSeries) > 0 { 1647 return atomic.LoadUint64(&m.GetProofCounter) == uint64(len(m.GetProofMock.expectationSeries)) 1648 } 1649 1650 // if main expectation was set then invocations count should be greater than zero 1651 if m.GetProofMock.mainExpectation != nil { 1652 return atomic.LoadUint64(&m.GetProofCounter) > 0 1653 } 1654 1655 // if func was set then invocations count should be greater than zero 1656 if m.GetProofFunc != nil { 1657 return atomic.LoadUint64(&m.GetProofCounter) > 0 1658 } 1659 1660 return true 1661 } 1662 1663 type mUnsyncListMockIndexToRef struct { 1664 mock *UnsyncListMock 1665 mainExpectation *UnsyncListMockIndexToRefExpectation 1666 expectationSeries []*UnsyncListMockIndexToRefExpectation 1667 } 1668 1669 type UnsyncListMockIndexToRefExpectation struct { 1670 input *UnsyncListMockIndexToRefInput 1671 result *UnsyncListMockIndexToRefResult 1672 } 1673 1674 type UnsyncListMockIndexToRefInput struct { 1675 p int 1676 } 1677 1678 type UnsyncListMockIndexToRefResult struct { 1679 r core.RecordRef 1680 r1 error 1681 } 1682 1683 //Expect specifies that invocation of UnsyncList.IndexToRef is expected from 1 to Infinity times 1684 func (m *mUnsyncListMockIndexToRef) Expect(p int) *mUnsyncListMockIndexToRef { 1685 m.mock.IndexToRefFunc = nil 1686 m.expectationSeries = nil 1687 1688 if m.mainExpectation == nil { 1689 m.mainExpectation = &UnsyncListMockIndexToRefExpectation{} 1690 } 1691 m.mainExpectation.input = &UnsyncListMockIndexToRefInput{p} 1692 return m 1693 } 1694 1695 //Return specifies results of invocation of UnsyncList.IndexToRef 1696 func (m *mUnsyncListMockIndexToRef) Return(r core.RecordRef, r1 error) *UnsyncListMock { 1697 m.mock.IndexToRefFunc = nil 1698 m.expectationSeries = nil 1699 1700 if m.mainExpectation == nil { 1701 m.mainExpectation = &UnsyncListMockIndexToRefExpectation{} 1702 } 1703 m.mainExpectation.result = &UnsyncListMockIndexToRefResult{r, r1} 1704 return m.mock 1705 } 1706 1707 //ExpectOnce specifies that invocation of UnsyncList.IndexToRef is expected once 1708 func (m *mUnsyncListMockIndexToRef) ExpectOnce(p int) *UnsyncListMockIndexToRefExpectation { 1709 m.mock.IndexToRefFunc = nil 1710 m.mainExpectation = nil 1711 1712 expectation := &UnsyncListMockIndexToRefExpectation{} 1713 expectation.input = &UnsyncListMockIndexToRefInput{p} 1714 m.expectationSeries = append(m.expectationSeries, expectation) 1715 return expectation 1716 } 1717 1718 func (e *UnsyncListMockIndexToRefExpectation) Return(r core.RecordRef, r1 error) { 1719 e.result = &UnsyncListMockIndexToRefResult{r, r1} 1720 } 1721 1722 //Set uses given function f as a mock of UnsyncList.IndexToRef method 1723 func (m *mUnsyncListMockIndexToRef) Set(f func(p int) (r core.RecordRef, r1 error)) *UnsyncListMock { 1724 m.mainExpectation = nil 1725 m.expectationSeries = nil 1726 1727 m.mock.IndexToRefFunc = f 1728 return m.mock 1729 } 1730 1731 //IndexToRef implements github.com/insolar/insolar/network.UnsyncList interface 1732 func (m *UnsyncListMock) IndexToRef(p int) (r core.RecordRef, r1 error) { 1733 counter := atomic.AddUint64(&m.IndexToRefPreCounter, 1) 1734 defer atomic.AddUint64(&m.IndexToRefCounter, 1) 1735 1736 if len(m.IndexToRefMock.expectationSeries) > 0 { 1737 if counter > uint64(len(m.IndexToRefMock.expectationSeries)) { 1738 m.t.Fatalf("Unexpected call to UnsyncListMock.IndexToRef. %v", p) 1739 return 1740 } 1741 1742 input := m.IndexToRefMock.expectationSeries[counter-1].input 1743 testify_assert.Equal(m.t, *input, UnsyncListMockIndexToRefInput{p}, "UnsyncList.IndexToRef got unexpected parameters") 1744 1745 result := m.IndexToRefMock.expectationSeries[counter-1].result 1746 if result == nil { 1747 m.t.Fatal("No results are set for the UnsyncListMock.IndexToRef") 1748 return 1749 } 1750 1751 r = result.r 1752 r1 = result.r1 1753 1754 return 1755 } 1756 1757 if m.IndexToRefMock.mainExpectation != nil { 1758 1759 input := m.IndexToRefMock.mainExpectation.input 1760 if input != nil { 1761 testify_assert.Equal(m.t, *input, UnsyncListMockIndexToRefInput{p}, "UnsyncList.IndexToRef got unexpected parameters") 1762 } 1763 1764 result := m.IndexToRefMock.mainExpectation.result 1765 if result == nil { 1766 m.t.Fatal("No results are set for the UnsyncListMock.IndexToRef") 1767 } 1768 1769 r = result.r 1770 r1 = result.r1 1771 1772 return 1773 } 1774 1775 if m.IndexToRefFunc == nil { 1776 m.t.Fatalf("Unexpected call to UnsyncListMock.IndexToRef. %v", p) 1777 return 1778 } 1779 1780 return m.IndexToRefFunc(p) 1781 } 1782 1783 //IndexToRefMinimockCounter returns a count of UnsyncListMock.IndexToRefFunc invocations 1784 func (m *UnsyncListMock) IndexToRefMinimockCounter() uint64 { 1785 return atomic.LoadUint64(&m.IndexToRefCounter) 1786 } 1787 1788 //IndexToRefMinimockPreCounter returns the value of UnsyncListMock.IndexToRef invocations 1789 func (m *UnsyncListMock) IndexToRefMinimockPreCounter() uint64 { 1790 return atomic.LoadUint64(&m.IndexToRefPreCounter) 1791 } 1792 1793 //IndexToRefFinished returns true if mock invocations count is ok 1794 func (m *UnsyncListMock) IndexToRefFinished() bool { 1795 // if expectation series were set then invocations count should be equal to expectations count 1796 if len(m.IndexToRefMock.expectationSeries) > 0 { 1797 return atomic.LoadUint64(&m.IndexToRefCounter) == uint64(len(m.IndexToRefMock.expectationSeries)) 1798 } 1799 1800 // if main expectation was set then invocations count should be greater than zero 1801 if m.IndexToRefMock.mainExpectation != nil { 1802 return atomic.LoadUint64(&m.IndexToRefCounter) > 0 1803 } 1804 1805 // if func was set then invocations count should be greater than zero 1806 if m.IndexToRefFunc != nil { 1807 return atomic.LoadUint64(&m.IndexToRefCounter) > 0 1808 } 1809 1810 return true 1811 } 1812 1813 type mUnsyncListMockLength struct { 1814 mock *UnsyncListMock 1815 mainExpectation *UnsyncListMockLengthExpectation 1816 expectationSeries []*UnsyncListMockLengthExpectation 1817 } 1818 1819 type UnsyncListMockLengthExpectation struct { 1820 result *UnsyncListMockLengthResult 1821 } 1822 1823 type UnsyncListMockLengthResult struct { 1824 r int 1825 } 1826 1827 //Expect specifies that invocation of UnsyncList.Length is expected from 1 to Infinity times 1828 func (m *mUnsyncListMockLength) Expect() *mUnsyncListMockLength { 1829 m.mock.LengthFunc = nil 1830 m.expectationSeries = nil 1831 1832 if m.mainExpectation == nil { 1833 m.mainExpectation = &UnsyncListMockLengthExpectation{} 1834 } 1835 1836 return m 1837 } 1838 1839 //Return specifies results of invocation of UnsyncList.Length 1840 func (m *mUnsyncListMockLength) Return(r int) *UnsyncListMock { 1841 m.mock.LengthFunc = nil 1842 m.expectationSeries = nil 1843 1844 if m.mainExpectation == nil { 1845 m.mainExpectation = &UnsyncListMockLengthExpectation{} 1846 } 1847 m.mainExpectation.result = &UnsyncListMockLengthResult{r} 1848 return m.mock 1849 } 1850 1851 //ExpectOnce specifies that invocation of UnsyncList.Length is expected once 1852 func (m *mUnsyncListMockLength) ExpectOnce() *UnsyncListMockLengthExpectation { 1853 m.mock.LengthFunc = nil 1854 m.mainExpectation = nil 1855 1856 expectation := &UnsyncListMockLengthExpectation{} 1857 1858 m.expectationSeries = append(m.expectationSeries, expectation) 1859 return expectation 1860 } 1861 1862 func (e *UnsyncListMockLengthExpectation) Return(r int) { 1863 e.result = &UnsyncListMockLengthResult{r} 1864 } 1865 1866 //Set uses given function f as a mock of UnsyncList.Length method 1867 func (m *mUnsyncListMockLength) Set(f func() (r int)) *UnsyncListMock { 1868 m.mainExpectation = nil 1869 m.expectationSeries = nil 1870 1871 m.mock.LengthFunc = f 1872 return m.mock 1873 } 1874 1875 //Length implements github.com/insolar/insolar/network.UnsyncList interface 1876 func (m *UnsyncListMock) Length() (r int) { 1877 counter := atomic.AddUint64(&m.LengthPreCounter, 1) 1878 defer atomic.AddUint64(&m.LengthCounter, 1) 1879 1880 if len(m.LengthMock.expectationSeries) > 0 { 1881 if counter > uint64(len(m.LengthMock.expectationSeries)) { 1882 m.t.Fatalf("Unexpected call to UnsyncListMock.Length.") 1883 return 1884 } 1885 1886 result := m.LengthMock.expectationSeries[counter-1].result 1887 if result == nil { 1888 m.t.Fatal("No results are set for the UnsyncListMock.Length") 1889 return 1890 } 1891 1892 r = result.r 1893 1894 return 1895 } 1896 1897 if m.LengthMock.mainExpectation != nil { 1898 1899 result := m.LengthMock.mainExpectation.result 1900 if result == nil { 1901 m.t.Fatal("No results are set for the UnsyncListMock.Length") 1902 } 1903 1904 r = result.r 1905 1906 return 1907 } 1908 1909 if m.LengthFunc == nil { 1910 m.t.Fatalf("Unexpected call to UnsyncListMock.Length.") 1911 return 1912 } 1913 1914 return m.LengthFunc() 1915 } 1916 1917 //LengthMinimockCounter returns a count of UnsyncListMock.LengthFunc invocations 1918 func (m *UnsyncListMock) LengthMinimockCounter() uint64 { 1919 return atomic.LoadUint64(&m.LengthCounter) 1920 } 1921 1922 //LengthMinimockPreCounter returns the value of UnsyncListMock.Length invocations 1923 func (m *UnsyncListMock) LengthMinimockPreCounter() uint64 { 1924 return atomic.LoadUint64(&m.LengthPreCounter) 1925 } 1926 1927 //LengthFinished returns true if mock invocations count is ok 1928 func (m *UnsyncListMock) LengthFinished() bool { 1929 // if expectation series were set then invocations count should be equal to expectations count 1930 if len(m.LengthMock.expectationSeries) > 0 { 1931 return atomic.LoadUint64(&m.LengthCounter) == uint64(len(m.LengthMock.expectationSeries)) 1932 } 1933 1934 // if main expectation was set then invocations count should be greater than zero 1935 if m.LengthMock.mainExpectation != nil { 1936 return atomic.LoadUint64(&m.LengthCounter) > 0 1937 } 1938 1939 // if func was set then invocations count should be greater than zero 1940 if m.LengthFunc != nil { 1941 return atomic.LoadUint64(&m.LengthCounter) > 0 1942 } 1943 1944 return true 1945 } 1946 1947 type mUnsyncListMockRefToIndex struct { 1948 mock *UnsyncListMock 1949 mainExpectation *UnsyncListMockRefToIndexExpectation 1950 expectationSeries []*UnsyncListMockRefToIndexExpectation 1951 } 1952 1953 type UnsyncListMockRefToIndexExpectation struct { 1954 input *UnsyncListMockRefToIndexInput 1955 result *UnsyncListMockRefToIndexResult 1956 } 1957 1958 type UnsyncListMockRefToIndexInput struct { 1959 p core.RecordRef 1960 } 1961 1962 type UnsyncListMockRefToIndexResult struct { 1963 r int 1964 r1 error 1965 } 1966 1967 //Expect specifies that invocation of UnsyncList.RefToIndex is expected from 1 to Infinity times 1968 func (m *mUnsyncListMockRefToIndex) Expect(p core.RecordRef) *mUnsyncListMockRefToIndex { 1969 m.mock.RefToIndexFunc = nil 1970 m.expectationSeries = nil 1971 1972 if m.mainExpectation == nil { 1973 m.mainExpectation = &UnsyncListMockRefToIndexExpectation{} 1974 } 1975 m.mainExpectation.input = &UnsyncListMockRefToIndexInput{p} 1976 return m 1977 } 1978 1979 //Return specifies results of invocation of UnsyncList.RefToIndex 1980 func (m *mUnsyncListMockRefToIndex) Return(r int, r1 error) *UnsyncListMock { 1981 m.mock.RefToIndexFunc = nil 1982 m.expectationSeries = nil 1983 1984 if m.mainExpectation == nil { 1985 m.mainExpectation = &UnsyncListMockRefToIndexExpectation{} 1986 } 1987 m.mainExpectation.result = &UnsyncListMockRefToIndexResult{r, r1} 1988 return m.mock 1989 } 1990 1991 //ExpectOnce specifies that invocation of UnsyncList.RefToIndex is expected once 1992 func (m *mUnsyncListMockRefToIndex) ExpectOnce(p core.RecordRef) *UnsyncListMockRefToIndexExpectation { 1993 m.mock.RefToIndexFunc = nil 1994 m.mainExpectation = nil 1995 1996 expectation := &UnsyncListMockRefToIndexExpectation{} 1997 expectation.input = &UnsyncListMockRefToIndexInput{p} 1998 m.expectationSeries = append(m.expectationSeries, expectation) 1999 return expectation 2000 } 2001 2002 func (e *UnsyncListMockRefToIndexExpectation) Return(r int, r1 error) { 2003 e.result = &UnsyncListMockRefToIndexResult{r, r1} 2004 } 2005 2006 //Set uses given function f as a mock of UnsyncList.RefToIndex method 2007 func (m *mUnsyncListMockRefToIndex) Set(f func(p core.RecordRef) (r int, r1 error)) *UnsyncListMock { 2008 m.mainExpectation = nil 2009 m.expectationSeries = nil 2010 2011 m.mock.RefToIndexFunc = f 2012 return m.mock 2013 } 2014 2015 //RefToIndex implements github.com/insolar/insolar/network.UnsyncList interface 2016 func (m *UnsyncListMock) RefToIndex(p core.RecordRef) (r int, r1 error) { 2017 counter := atomic.AddUint64(&m.RefToIndexPreCounter, 1) 2018 defer atomic.AddUint64(&m.RefToIndexCounter, 1) 2019 2020 if len(m.RefToIndexMock.expectationSeries) > 0 { 2021 if counter > uint64(len(m.RefToIndexMock.expectationSeries)) { 2022 m.t.Fatalf("Unexpected call to UnsyncListMock.RefToIndex. %v", p) 2023 return 2024 } 2025 2026 input := m.RefToIndexMock.expectationSeries[counter-1].input 2027 testify_assert.Equal(m.t, *input, UnsyncListMockRefToIndexInput{p}, "UnsyncList.RefToIndex got unexpected parameters") 2028 2029 result := m.RefToIndexMock.expectationSeries[counter-1].result 2030 if result == nil { 2031 m.t.Fatal("No results are set for the UnsyncListMock.RefToIndex") 2032 return 2033 } 2034 2035 r = result.r 2036 r1 = result.r1 2037 2038 return 2039 } 2040 2041 if m.RefToIndexMock.mainExpectation != nil { 2042 2043 input := m.RefToIndexMock.mainExpectation.input 2044 if input != nil { 2045 testify_assert.Equal(m.t, *input, UnsyncListMockRefToIndexInput{p}, "UnsyncList.RefToIndex got unexpected parameters") 2046 } 2047 2048 result := m.RefToIndexMock.mainExpectation.result 2049 if result == nil { 2050 m.t.Fatal("No results are set for the UnsyncListMock.RefToIndex") 2051 } 2052 2053 r = result.r 2054 r1 = result.r1 2055 2056 return 2057 } 2058 2059 if m.RefToIndexFunc == nil { 2060 m.t.Fatalf("Unexpected call to UnsyncListMock.RefToIndex. %v", p) 2061 return 2062 } 2063 2064 return m.RefToIndexFunc(p) 2065 } 2066 2067 //RefToIndexMinimockCounter returns a count of UnsyncListMock.RefToIndexFunc invocations 2068 func (m *UnsyncListMock) RefToIndexMinimockCounter() uint64 { 2069 return atomic.LoadUint64(&m.RefToIndexCounter) 2070 } 2071 2072 //RefToIndexMinimockPreCounter returns the value of UnsyncListMock.RefToIndex invocations 2073 func (m *UnsyncListMock) RefToIndexMinimockPreCounter() uint64 { 2074 return atomic.LoadUint64(&m.RefToIndexPreCounter) 2075 } 2076 2077 //RefToIndexFinished returns true if mock invocations count is ok 2078 func (m *UnsyncListMock) RefToIndexFinished() bool { 2079 // if expectation series were set then invocations count should be equal to expectations count 2080 if len(m.RefToIndexMock.expectationSeries) > 0 { 2081 return atomic.LoadUint64(&m.RefToIndexCounter) == uint64(len(m.RefToIndexMock.expectationSeries)) 2082 } 2083 2084 // if main expectation was set then invocations count should be greater than zero 2085 if m.RefToIndexMock.mainExpectation != nil { 2086 return atomic.LoadUint64(&m.RefToIndexCounter) > 0 2087 } 2088 2089 // if func was set then invocations count should be greater than zero 2090 if m.RefToIndexFunc != nil { 2091 return atomic.LoadUint64(&m.RefToIndexCounter) > 0 2092 } 2093 2094 return true 2095 } 2096 2097 type mUnsyncListMockRemoveNode struct { 2098 mock *UnsyncListMock 2099 mainExpectation *UnsyncListMockRemoveNodeExpectation 2100 expectationSeries []*UnsyncListMockRemoveNodeExpectation 2101 } 2102 2103 type UnsyncListMockRemoveNodeExpectation struct { 2104 input *UnsyncListMockRemoveNodeInput 2105 } 2106 2107 type UnsyncListMockRemoveNodeInput struct { 2108 p core.RecordRef 2109 } 2110 2111 //Expect specifies that invocation of UnsyncList.RemoveNode is expected from 1 to Infinity times 2112 func (m *mUnsyncListMockRemoveNode) Expect(p core.RecordRef) *mUnsyncListMockRemoveNode { 2113 m.mock.RemoveNodeFunc = nil 2114 m.expectationSeries = nil 2115 2116 if m.mainExpectation == nil { 2117 m.mainExpectation = &UnsyncListMockRemoveNodeExpectation{} 2118 } 2119 m.mainExpectation.input = &UnsyncListMockRemoveNodeInput{p} 2120 return m 2121 } 2122 2123 //Return specifies results of invocation of UnsyncList.RemoveNode 2124 func (m *mUnsyncListMockRemoveNode) Return() *UnsyncListMock { 2125 m.mock.RemoveNodeFunc = nil 2126 m.expectationSeries = nil 2127 2128 if m.mainExpectation == nil { 2129 m.mainExpectation = &UnsyncListMockRemoveNodeExpectation{} 2130 } 2131 2132 return m.mock 2133 } 2134 2135 //ExpectOnce specifies that invocation of UnsyncList.RemoveNode is expected once 2136 func (m *mUnsyncListMockRemoveNode) ExpectOnce(p core.RecordRef) *UnsyncListMockRemoveNodeExpectation { 2137 m.mock.RemoveNodeFunc = nil 2138 m.mainExpectation = nil 2139 2140 expectation := &UnsyncListMockRemoveNodeExpectation{} 2141 expectation.input = &UnsyncListMockRemoveNodeInput{p} 2142 m.expectationSeries = append(m.expectationSeries, expectation) 2143 return expectation 2144 } 2145 2146 //Set uses given function f as a mock of UnsyncList.RemoveNode method 2147 func (m *mUnsyncListMockRemoveNode) Set(f func(p core.RecordRef)) *UnsyncListMock { 2148 m.mainExpectation = nil 2149 m.expectationSeries = nil 2150 2151 m.mock.RemoveNodeFunc = f 2152 return m.mock 2153 } 2154 2155 //RemoveNode implements github.com/insolar/insolar/network.UnsyncList interface 2156 func (m *UnsyncListMock) RemoveNode(p core.RecordRef) { 2157 counter := atomic.AddUint64(&m.RemoveNodePreCounter, 1) 2158 defer atomic.AddUint64(&m.RemoveNodeCounter, 1) 2159 2160 if len(m.RemoveNodeMock.expectationSeries) > 0 { 2161 if counter > uint64(len(m.RemoveNodeMock.expectationSeries)) { 2162 m.t.Fatalf("Unexpected call to UnsyncListMock.RemoveNode. %v", p) 2163 return 2164 } 2165 2166 input := m.RemoveNodeMock.expectationSeries[counter-1].input 2167 testify_assert.Equal(m.t, *input, UnsyncListMockRemoveNodeInput{p}, "UnsyncList.RemoveNode got unexpected parameters") 2168 2169 return 2170 } 2171 2172 if m.RemoveNodeMock.mainExpectation != nil { 2173 2174 input := m.RemoveNodeMock.mainExpectation.input 2175 if input != nil { 2176 testify_assert.Equal(m.t, *input, UnsyncListMockRemoveNodeInput{p}, "UnsyncList.RemoveNode got unexpected parameters") 2177 } 2178 2179 return 2180 } 2181 2182 if m.RemoveNodeFunc == nil { 2183 m.t.Fatalf("Unexpected call to UnsyncListMock.RemoveNode. %v", p) 2184 return 2185 } 2186 2187 m.RemoveNodeFunc(p) 2188 } 2189 2190 //RemoveNodeMinimockCounter returns a count of UnsyncListMock.RemoveNodeFunc invocations 2191 func (m *UnsyncListMock) RemoveNodeMinimockCounter() uint64 { 2192 return atomic.LoadUint64(&m.RemoveNodeCounter) 2193 } 2194 2195 //RemoveNodeMinimockPreCounter returns the value of UnsyncListMock.RemoveNode invocations 2196 func (m *UnsyncListMock) RemoveNodeMinimockPreCounter() uint64 { 2197 return atomic.LoadUint64(&m.RemoveNodePreCounter) 2198 } 2199 2200 //RemoveNodeFinished returns true if mock invocations count is ok 2201 func (m *UnsyncListMock) RemoveNodeFinished() bool { 2202 // if expectation series were set then invocations count should be equal to expectations count 2203 if len(m.RemoveNodeMock.expectationSeries) > 0 { 2204 return atomic.LoadUint64(&m.RemoveNodeCounter) == uint64(len(m.RemoveNodeMock.expectationSeries)) 2205 } 2206 2207 // if main expectation was set then invocations count should be greater than zero 2208 if m.RemoveNodeMock.mainExpectation != nil { 2209 return atomic.LoadUint64(&m.RemoveNodeCounter) > 0 2210 } 2211 2212 // if func was set then invocations count should be greater than zero 2213 if m.RemoveNodeFunc != nil { 2214 return atomic.LoadUint64(&m.RemoveNodeCounter) > 0 2215 } 2216 2217 return true 2218 } 2219 2220 type mUnsyncListMockSetGlobuleHashSignature struct { 2221 mock *UnsyncListMock 2222 mainExpectation *UnsyncListMockSetGlobuleHashSignatureExpectation 2223 expectationSeries []*UnsyncListMockSetGlobuleHashSignatureExpectation 2224 } 2225 2226 type UnsyncListMockSetGlobuleHashSignatureExpectation struct { 2227 input *UnsyncListMockSetGlobuleHashSignatureInput 2228 } 2229 2230 type UnsyncListMockSetGlobuleHashSignatureInput struct { 2231 p core.RecordRef 2232 p1 packets.GlobuleHashSignature 2233 } 2234 2235 //Expect specifies that invocation of UnsyncList.SetGlobuleHashSignature is expected from 1 to Infinity times 2236 func (m *mUnsyncListMockSetGlobuleHashSignature) Expect(p core.RecordRef, p1 packets.GlobuleHashSignature) *mUnsyncListMockSetGlobuleHashSignature { 2237 m.mock.SetGlobuleHashSignatureFunc = nil 2238 m.expectationSeries = nil 2239 2240 if m.mainExpectation == nil { 2241 m.mainExpectation = &UnsyncListMockSetGlobuleHashSignatureExpectation{} 2242 } 2243 m.mainExpectation.input = &UnsyncListMockSetGlobuleHashSignatureInput{p, p1} 2244 return m 2245 } 2246 2247 //Return specifies results of invocation of UnsyncList.SetGlobuleHashSignature 2248 func (m *mUnsyncListMockSetGlobuleHashSignature) Return() *UnsyncListMock { 2249 m.mock.SetGlobuleHashSignatureFunc = nil 2250 m.expectationSeries = nil 2251 2252 if m.mainExpectation == nil { 2253 m.mainExpectation = &UnsyncListMockSetGlobuleHashSignatureExpectation{} 2254 } 2255 2256 return m.mock 2257 } 2258 2259 //ExpectOnce specifies that invocation of UnsyncList.SetGlobuleHashSignature is expected once 2260 func (m *mUnsyncListMockSetGlobuleHashSignature) ExpectOnce(p core.RecordRef, p1 packets.GlobuleHashSignature) *UnsyncListMockSetGlobuleHashSignatureExpectation { 2261 m.mock.SetGlobuleHashSignatureFunc = nil 2262 m.mainExpectation = nil 2263 2264 expectation := &UnsyncListMockSetGlobuleHashSignatureExpectation{} 2265 expectation.input = &UnsyncListMockSetGlobuleHashSignatureInput{p, p1} 2266 m.expectationSeries = append(m.expectationSeries, expectation) 2267 return expectation 2268 } 2269 2270 //Set uses given function f as a mock of UnsyncList.SetGlobuleHashSignature method 2271 func (m *mUnsyncListMockSetGlobuleHashSignature) Set(f func(p core.RecordRef, p1 packets.GlobuleHashSignature)) *UnsyncListMock { 2272 m.mainExpectation = nil 2273 m.expectationSeries = nil 2274 2275 m.mock.SetGlobuleHashSignatureFunc = f 2276 return m.mock 2277 } 2278 2279 //SetGlobuleHashSignature implements github.com/insolar/insolar/network.UnsyncList interface 2280 func (m *UnsyncListMock) SetGlobuleHashSignature(p core.RecordRef, p1 packets.GlobuleHashSignature) { 2281 counter := atomic.AddUint64(&m.SetGlobuleHashSignaturePreCounter, 1) 2282 defer atomic.AddUint64(&m.SetGlobuleHashSignatureCounter, 1) 2283 2284 if len(m.SetGlobuleHashSignatureMock.expectationSeries) > 0 { 2285 if counter > uint64(len(m.SetGlobuleHashSignatureMock.expectationSeries)) { 2286 m.t.Fatalf("Unexpected call to UnsyncListMock.SetGlobuleHashSignature. %v %v", p, p1) 2287 return 2288 } 2289 2290 input := m.SetGlobuleHashSignatureMock.expectationSeries[counter-1].input 2291 testify_assert.Equal(m.t, *input, UnsyncListMockSetGlobuleHashSignatureInput{p, p1}, "UnsyncList.SetGlobuleHashSignature got unexpected parameters") 2292 2293 return 2294 } 2295 2296 if m.SetGlobuleHashSignatureMock.mainExpectation != nil { 2297 2298 input := m.SetGlobuleHashSignatureMock.mainExpectation.input 2299 if input != nil { 2300 testify_assert.Equal(m.t, *input, UnsyncListMockSetGlobuleHashSignatureInput{p, p1}, "UnsyncList.SetGlobuleHashSignature got unexpected parameters") 2301 } 2302 2303 return 2304 } 2305 2306 if m.SetGlobuleHashSignatureFunc == nil { 2307 m.t.Fatalf("Unexpected call to UnsyncListMock.SetGlobuleHashSignature. %v %v", p, p1) 2308 return 2309 } 2310 2311 m.SetGlobuleHashSignatureFunc(p, p1) 2312 } 2313 2314 //SetGlobuleHashSignatureMinimockCounter returns a count of UnsyncListMock.SetGlobuleHashSignatureFunc invocations 2315 func (m *UnsyncListMock) SetGlobuleHashSignatureMinimockCounter() uint64 { 2316 return atomic.LoadUint64(&m.SetGlobuleHashSignatureCounter) 2317 } 2318 2319 //SetGlobuleHashSignatureMinimockPreCounter returns the value of UnsyncListMock.SetGlobuleHashSignature invocations 2320 func (m *UnsyncListMock) SetGlobuleHashSignatureMinimockPreCounter() uint64 { 2321 return atomic.LoadUint64(&m.SetGlobuleHashSignaturePreCounter) 2322 } 2323 2324 //SetGlobuleHashSignatureFinished returns true if mock invocations count is ok 2325 func (m *UnsyncListMock) SetGlobuleHashSignatureFinished() bool { 2326 // if expectation series were set then invocations count should be equal to expectations count 2327 if len(m.SetGlobuleHashSignatureMock.expectationSeries) > 0 { 2328 return atomic.LoadUint64(&m.SetGlobuleHashSignatureCounter) == uint64(len(m.SetGlobuleHashSignatureMock.expectationSeries)) 2329 } 2330 2331 // if main expectation was set then invocations count should be greater than zero 2332 if m.SetGlobuleHashSignatureMock.mainExpectation != nil { 2333 return atomic.LoadUint64(&m.SetGlobuleHashSignatureCounter) > 0 2334 } 2335 2336 // if func was set then invocations count should be greater than zero 2337 if m.SetGlobuleHashSignatureFunc != nil { 2338 return atomic.LoadUint64(&m.SetGlobuleHashSignatureCounter) > 0 2339 } 2340 2341 return true 2342 } 2343 2344 //ValidateCallCounters checks that all mocked methods of the interface have been called at least once 2345 //Deprecated: please use MinimockFinish method or use Finish method of minimock.Controller 2346 func (m *UnsyncListMock) ValidateCallCounters() { 2347 2348 if !m.AddClaimsFinished() { 2349 m.t.Fatal("Expected call to UnsyncListMock.AddClaims") 2350 } 2351 2352 if !m.AddNodeFinished() { 2353 m.t.Fatal("Expected call to UnsyncListMock.AddNode") 2354 } 2355 2356 if !m.AddProofFinished() { 2357 m.t.Fatal("Expected call to UnsyncListMock.AddProof") 2358 } 2359 2360 if !m.ApproveSyncFinished() { 2361 m.t.Fatal("Expected call to UnsyncListMock.ApproveSync") 2362 } 2363 2364 if !m.CalculateHashFinished() { 2365 m.t.Fatal("Expected call to UnsyncListMock.CalculateHash") 2366 } 2367 2368 if !m.GetActiveNodeFinished() { 2369 m.t.Fatal("Expected call to UnsyncListMock.GetActiveNode") 2370 } 2371 2372 if !m.GetActiveNodesFinished() { 2373 m.t.Fatal("Expected call to UnsyncListMock.GetActiveNodes") 2374 } 2375 2376 if !m.GetClaimsFinished() { 2377 m.t.Fatal("Expected call to UnsyncListMock.GetClaims") 2378 } 2379 2380 if !m.GetGlobuleHashSignatureFinished() { 2381 m.t.Fatal("Expected call to UnsyncListMock.GetGlobuleHashSignature") 2382 } 2383 2384 if !m.GetMergedCopyFinished() { 2385 m.t.Fatal("Expected call to UnsyncListMock.GetMergedCopy") 2386 } 2387 2388 if !m.GetProofFinished() { 2389 m.t.Fatal("Expected call to UnsyncListMock.GetProof") 2390 } 2391 2392 if !m.IndexToRefFinished() { 2393 m.t.Fatal("Expected call to UnsyncListMock.IndexToRef") 2394 } 2395 2396 if !m.LengthFinished() { 2397 m.t.Fatal("Expected call to UnsyncListMock.Length") 2398 } 2399 2400 if !m.RefToIndexFinished() { 2401 m.t.Fatal("Expected call to UnsyncListMock.RefToIndex") 2402 } 2403 2404 if !m.RemoveNodeFinished() { 2405 m.t.Fatal("Expected call to UnsyncListMock.RemoveNode") 2406 } 2407 2408 if !m.SetGlobuleHashSignatureFinished() { 2409 m.t.Fatal("Expected call to UnsyncListMock.SetGlobuleHashSignature") 2410 } 2411 2412 } 2413 2414 //CheckMocksCalled checks that all mocked methods of the interface have been called at least once 2415 //Deprecated: please use MinimockFinish method or use Finish method of minimock.Controller 2416 func (m *UnsyncListMock) CheckMocksCalled() { 2417 m.Finish() 2418 } 2419 2420 //Finish checks that all mocked methods of the interface have been called at least once 2421 //Deprecated: please use MinimockFinish or use Finish method of minimock.Controller 2422 func (m *UnsyncListMock) Finish() { 2423 m.MinimockFinish() 2424 } 2425 2426 //MinimockFinish checks that all mocked methods of the interface have been called at least once 2427 func (m *UnsyncListMock) MinimockFinish() { 2428 2429 if !m.AddClaimsFinished() { 2430 m.t.Fatal("Expected call to UnsyncListMock.AddClaims") 2431 } 2432 2433 if !m.AddNodeFinished() { 2434 m.t.Fatal("Expected call to UnsyncListMock.AddNode") 2435 } 2436 2437 if !m.AddProofFinished() { 2438 m.t.Fatal("Expected call to UnsyncListMock.AddProof") 2439 } 2440 2441 if !m.ApproveSyncFinished() { 2442 m.t.Fatal("Expected call to UnsyncListMock.ApproveSync") 2443 } 2444 2445 if !m.CalculateHashFinished() { 2446 m.t.Fatal("Expected call to UnsyncListMock.CalculateHash") 2447 } 2448 2449 if !m.GetActiveNodeFinished() { 2450 m.t.Fatal("Expected call to UnsyncListMock.GetActiveNode") 2451 } 2452 2453 if !m.GetActiveNodesFinished() { 2454 m.t.Fatal("Expected call to UnsyncListMock.GetActiveNodes") 2455 } 2456 2457 if !m.GetClaimsFinished() { 2458 m.t.Fatal("Expected call to UnsyncListMock.GetClaims") 2459 } 2460 2461 if !m.GetGlobuleHashSignatureFinished() { 2462 m.t.Fatal("Expected call to UnsyncListMock.GetGlobuleHashSignature") 2463 } 2464 2465 if !m.GetMergedCopyFinished() { 2466 m.t.Fatal("Expected call to UnsyncListMock.GetMergedCopy") 2467 } 2468 2469 if !m.GetProofFinished() { 2470 m.t.Fatal("Expected call to UnsyncListMock.GetProof") 2471 } 2472 2473 if !m.IndexToRefFinished() { 2474 m.t.Fatal("Expected call to UnsyncListMock.IndexToRef") 2475 } 2476 2477 if !m.LengthFinished() { 2478 m.t.Fatal("Expected call to UnsyncListMock.Length") 2479 } 2480 2481 if !m.RefToIndexFinished() { 2482 m.t.Fatal("Expected call to UnsyncListMock.RefToIndex") 2483 } 2484 2485 if !m.RemoveNodeFinished() { 2486 m.t.Fatal("Expected call to UnsyncListMock.RemoveNode") 2487 } 2488 2489 if !m.SetGlobuleHashSignatureFinished() { 2490 m.t.Fatal("Expected call to UnsyncListMock.SetGlobuleHashSignature") 2491 } 2492 2493 } 2494 2495 //Wait waits for all mocked methods to be called at least once 2496 //Deprecated: please use MinimockWait or use Wait method of minimock.Controller 2497 func (m *UnsyncListMock) Wait(timeout time.Duration) { 2498 m.MinimockWait(timeout) 2499 } 2500 2501 //MinimockWait waits for all mocked methods to be called at least once 2502 //this method is called by minimock.Controller 2503 func (m *UnsyncListMock) MinimockWait(timeout time.Duration) { 2504 timeoutCh := time.After(timeout) 2505 for { 2506 ok := true 2507 ok = ok && m.AddClaimsFinished() 2508 ok = ok && m.AddNodeFinished() 2509 ok = ok && m.AddProofFinished() 2510 ok = ok && m.ApproveSyncFinished() 2511 ok = ok && m.CalculateHashFinished() 2512 ok = ok && m.GetActiveNodeFinished() 2513 ok = ok && m.GetActiveNodesFinished() 2514 ok = ok && m.GetClaimsFinished() 2515 ok = ok && m.GetGlobuleHashSignatureFinished() 2516 ok = ok && m.GetMergedCopyFinished() 2517 ok = ok && m.GetProofFinished() 2518 ok = ok && m.IndexToRefFinished() 2519 ok = ok && m.LengthFinished() 2520 ok = ok && m.RefToIndexFinished() 2521 ok = ok && m.RemoveNodeFinished() 2522 ok = ok && m.SetGlobuleHashSignatureFinished() 2523 2524 if ok { 2525 return 2526 } 2527 2528 select { 2529 case <-timeoutCh: 2530 2531 if !m.AddClaimsFinished() { 2532 m.t.Error("Expected call to UnsyncListMock.AddClaims") 2533 } 2534 2535 if !m.AddNodeFinished() { 2536 m.t.Error("Expected call to UnsyncListMock.AddNode") 2537 } 2538 2539 if !m.AddProofFinished() { 2540 m.t.Error("Expected call to UnsyncListMock.AddProof") 2541 } 2542 2543 if !m.ApproveSyncFinished() { 2544 m.t.Error("Expected call to UnsyncListMock.ApproveSync") 2545 } 2546 2547 if !m.CalculateHashFinished() { 2548 m.t.Error("Expected call to UnsyncListMock.CalculateHash") 2549 } 2550 2551 if !m.GetActiveNodeFinished() { 2552 m.t.Error("Expected call to UnsyncListMock.GetActiveNode") 2553 } 2554 2555 if !m.GetActiveNodesFinished() { 2556 m.t.Error("Expected call to UnsyncListMock.GetActiveNodes") 2557 } 2558 2559 if !m.GetClaimsFinished() { 2560 m.t.Error("Expected call to UnsyncListMock.GetClaims") 2561 } 2562 2563 if !m.GetGlobuleHashSignatureFinished() { 2564 m.t.Error("Expected call to UnsyncListMock.GetGlobuleHashSignature") 2565 } 2566 2567 if !m.GetMergedCopyFinished() { 2568 m.t.Error("Expected call to UnsyncListMock.GetMergedCopy") 2569 } 2570 2571 if !m.GetProofFinished() { 2572 m.t.Error("Expected call to UnsyncListMock.GetProof") 2573 } 2574 2575 if !m.IndexToRefFinished() { 2576 m.t.Error("Expected call to UnsyncListMock.IndexToRef") 2577 } 2578 2579 if !m.LengthFinished() { 2580 m.t.Error("Expected call to UnsyncListMock.Length") 2581 } 2582 2583 if !m.RefToIndexFinished() { 2584 m.t.Error("Expected call to UnsyncListMock.RefToIndex") 2585 } 2586 2587 if !m.RemoveNodeFinished() { 2588 m.t.Error("Expected call to UnsyncListMock.RemoveNode") 2589 } 2590 2591 if !m.SetGlobuleHashSignatureFinished() { 2592 m.t.Error("Expected call to UnsyncListMock.SetGlobuleHashSignature") 2593 } 2594 2595 m.t.Fatalf("Some mocks were not called on time: %s", timeout) 2596 return 2597 default: 2598 time.Sleep(time.Millisecond) 2599 } 2600 } 2601 } 2602 2603 //AllMocksCalled returns true if all mocked methods were called before the execution of AllMocksCalled, 2604 //it can be used with assert/require, i.e. assert.True(mock.AllMocksCalled()) 2605 func (m *UnsyncListMock) AllMocksCalled() bool { 2606 2607 if !m.AddClaimsFinished() { 2608 return false 2609 } 2610 2611 if !m.AddNodeFinished() { 2612 return false 2613 } 2614 2615 if !m.AddProofFinished() { 2616 return false 2617 } 2618 2619 if !m.ApproveSyncFinished() { 2620 return false 2621 } 2622 2623 if !m.CalculateHashFinished() { 2624 return false 2625 } 2626 2627 if !m.GetActiveNodeFinished() { 2628 return false 2629 } 2630 2631 if !m.GetActiveNodesFinished() { 2632 return false 2633 } 2634 2635 if !m.GetClaimsFinished() { 2636 return false 2637 } 2638 2639 if !m.GetGlobuleHashSignatureFinished() { 2640 return false 2641 } 2642 2643 if !m.GetMergedCopyFinished() { 2644 return false 2645 } 2646 2647 if !m.GetProofFinished() { 2648 return false 2649 } 2650 2651 if !m.IndexToRefFinished() { 2652 return false 2653 } 2654 2655 if !m.LengthFinished() { 2656 return false 2657 } 2658 2659 if !m.RefToIndexFinished() { 2660 return false 2661 } 2662 2663 if !m.RemoveNodeFinished() { 2664 return false 2665 } 2666 2667 if !m.SetGlobuleHashSignatureFinished() { 2668 return false 2669 } 2670 2671 return true 2672 }