github.com/braveheart12/insolar-09-08-19@v0.8.7/ledger/storage/drop_storage_mock.go (about) 1 package storage 2 3 /* 4 DO NOT EDIT! 5 This code was generated automatically using github.com/gojuno/minimock v1.9 6 The original interface "DropStorage" can be found in github.com/insolar/insolar/ledger/storage 7 */ 8 import ( 9 context "context" 10 "sync/atomic" 11 "time" 12 13 "github.com/gojuno/minimock" 14 core "github.com/insolar/insolar/core" 15 jet "github.com/insolar/insolar/ledger/storage/jet" 16 17 testify_assert "github.com/stretchr/testify/assert" 18 ) 19 20 //DropStorageMock implements github.com/insolar/insolar/ledger/storage.DropStorage 21 type DropStorageMock struct { 22 t minimock.Tester 23 24 AddDropSizeFunc func(p context.Context, p1 *jet.DropSize) (r error) 25 AddDropSizeCounter uint64 26 AddDropSizePreCounter uint64 27 AddDropSizeMock mDropStorageMockAddDropSize 28 29 CreateDropFunc func(p context.Context, p1 core.RecordID, p2 core.PulseNumber, p3 []byte) (r *jet.JetDrop, r1 [][]byte, r2 uint64, r3 error) 30 CreateDropCounter uint64 31 CreateDropPreCounter uint64 32 CreateDropMock mDropStorageMockCreateDrop 33 34 GetDropFunc func(p context.Context, p1 core.RecordID, p2 core.PulseNumber) (r *jet.JetDrop, r1 error) 35 GetDropCounter uint64 36 GetDropPreCounter uint64 37 GetDropMock mDropStorageMockGetDrop 38 39 GetDropSizeHistoryFunc func(p context.Context, p1 core.RecordID) (r jet.DropSizeHistory, r1 error) 40 GetDropSizeHistoryCounter uint64 41 GetDropSizeHistoryPreCounter uint64 42 GetDropSizeHistoryMock mDropStorageMockGetDropSizeHistory 43 44 GetJetSizesHistoryDepthFunc func() (r int) 45 GetJetSizesHistoryDepthCounter uint64 46 GetJetSizesHistoryDepthPreCounter uint64 47 GetJetSizesHistoryDepthMock mDropStorageMockGetJetSizesHistoryDepth 48 49 SetDropFunc func(p context.Context, p1 core.RecordID, p2 *jet.JetDrop) (r error) 50 SetDropCounter uint64 51 SetDropPreCounter uint64 52 SetDropMock mDropStorageMockSetDrop 53 54 SetDropSizeHistoryFunc func(p context.Context, p1 core.RecordID, p2 jet.DropSizeHistory) (r error) 55 SetDropSizeHistoryCounter uint64 56 SetDropSizeHistoryPreCounter uint64 57 SetDropSizeHistoryMock mDropStorageMockSetDropSizeHistory 58 } 59 60 //NewDropStorageMock returns a mock for github.com/insolar/insolar/ledger/storage.DropStorage 61 func NewDropStorageMock(t minimock.Tester) *DropStorageMock { 62 m := &DropStorageMock{t: t} 63 64 if controller, ok := t.(minimock.MockController); ok { 65 controller.RegisterMocker(m) 66 } 67 68 m.AddDropSizeMock = mDropStorageMockAddDropSize{mock: m} 69 m.CreateDropMock = mDropStorageMockCreateDrop{mock: m} 70 m.GetDropMock = mDropStorageMockGetDrop{mock: m} 71 m.GetDropSizeHistoryMock = mDropStorageMockGetDropSizeHistory{mock: m} 72 m.GetJetSizesHistoryDepthMock = mDropStorageMockGetJetSizesHistoryDepth{mock: m} 73 m.SetDropMock = mDropStorageMockSetDrop{mock: m} 74 m.SetDropSizeHistoryMock = mDropStorageMockSetDropSizeHistory{mock: m} 75 76 return m 77 } 78 79 type mDropStorageMockAddDropSize struct { 80 mock *DropStorageMock 81 mainExpectation *DropStorageMockAddDropSizeExpectation 82 expectationSeries []*DropStorageMockAddDropSizeExpectation 83 } 84 85 type DropStorageMockAddDropSizeExpectation struct { 86 input *DropStorageMockAddDropSizeInput 87 result *DropStorageMockAddDropSizeResult 88 } 89 90 type DropStorageMockAddDropSizeInput struct { 91 p context.Context 92 p1 *jet.DropSize 93 } 94 95 type DropStorageMockAddDropSizeResult struct { 96 r error 97 } 98 99 //Expect specifies that invocation of DropStorage.AddDropSize is expected from 1 to Infinity times 100 func (m *mDropStorageMockAddDropSize) Expect(p context.Context, p1 *jet.DropSize) *mDropStorageMockAddDropSize { 101 m.mock.AddDropSizeFunc = nil 102 m.expectationSeries = nil 103 104 if m.mainExpectation == nil { 105 m.mainExpectation = &DropStorageMockAddDropSizeExpectation{} 106 } 107 m.mainExpectation.input = &DropStorageMockAddDropSizeInput{p, p1} 108 return m 109 } 110 111 //Return specifies results of invocation of DropStorage.AddDropSize 112 func (m *mDropStorageMockAddDropSize) Return(r error) *DropStorageMock { 113 m.mock.AddDropSizeFunc = nil 114 m.expectationSeries = nil 115 116 if m.mainExpectation == nil { 117 m.mainExpectation = &DropStorageMockAddDropSizeExpectation{} 118 } 119 m.mainExpectation.result = &DropStorageMockAddDropSizeResult{r} 120 return m.mock 121 } 122 123 //ExpectOnce specifies that invocation of DropStorage.AddDropSize is expected once 124 func (m *mDropStorageMockAddDropSize) ExpectOnce(p context.Context, p1 *jet.DropSize) *DropStorageMockAddDropSizeExpectation { 125 m.mock.AddDropSizeFunc = nil 126 m.mainExpectation = nil 127 128 expectation := &DropStorageMockAddDropSizeExpectation{} 129 expectation.input = &DropStorageMockAddDropSizeInput{p, p1} 130 m.expectationSeries = append(m.expectationSeries, expectation) 131 return expectation 132 } 133 134 func (e *DropStorageMockAddDropSizeExpectation) Return(r error) { 135 e.result = &DropStorageMockAddDropSizeResult{r} 136 } 137 138 //Set uses given function f as a mock of DropStorage.AddDropSize method 139 func (m *mDropStorageMockAddDropSize) Set(f func(p context.Context, p1 *jet.DropSize) (r error)) *DropStorageMock { 140 m.mainExpectation = nil 141 m.expectationSeries = nil 142 143 m.mock.AddDropSizeFunc = f 144 return m.mock 145 } 146 147 //AddDropSize implements github.com/insolar/insolar/ledger/storage.DropStorage interface 148 func (m *DropStorageMock) AddDropSize(p context.Context, p1 *jet.DropSize) (r error) { 149 counter := atomic.AddUint64(&m.AddDropSizePreCounter, 1) 150 defer atomic.AddUint64(&m.AddDropSizeCounter, 1) 151 152 if len(m.AddDropSizeMock.expectationSeries) > 0 { 153 if counter > uint64(len(m.AddDropSizeMock.expectationSeries)) { 154 m.t.Fatalf("Unexpected call to DropStorageMock.AddDropSize. %v %v", p, p1) 155 return 156 } 157 158 input := m.AddDropSizeMock.expectationSeries[counter-1].input 159 testify_assert.Equal(m.t, *input, DropStorageMockAddDropSizeInput{p, p1}, "DropStorage.AddDropSize got unexpected parameters") 160 161 result := m.AddDropSizeMock.expectationSeries[counter-1].result 162 if result == nil { 163 m.t.Fatal("No results are set for the DropStorageMock.AddDropSize") 164 return 165 } 166 167 r = result.r 168 169 return 170 } 171 172 if m.AddDropSizeMock.mainExpectation != nil { 173 174 input := m.AddDropSizeMock.mainExpectation.input 175 if input != nil { 176 testify_assert.Equal(m.t, *input, DropStorageMockAddDropSizeInput{p, p1}, "DropStorage.AddDropSize got unexpected parameters") 177 } 178 179 result := m.AddDropSizeMock.mainExpectation.result 180 if result == nil { 181 m.t.Fatal("No results are set for the DropStorageMock.AddDropSize") 182 } 183 184 r = result.r 185 186 return 187 } 188 189 if m.AddDropSizeFunc == nil { 190 m.t.Fatalf("Unexpected call to DropStorageMock.AddDropSize. %v %v", p, p1) 191 return 192 } 193 194 return m.AddDropSizeFunc(p, p1) 195 } 196 197 //AddDropSizeMinimockCounter returns a count of DropStorageMock.AddDropSizeFunc invocations 198 func (m *DropStorageMock) AddDropSizeMinimockCounter() uint64 { 199 return atomic.LoadUint64(&m.AddDropSizeCounter) 200 } 201 202 //AddDropSizeMinimockPreCounter returns the value of DropStorageMock.AddDropSize invocations 203 func (m *DropStorageMock) AddDropSizeMinimockPreCounter() uint64 { 204 return atomic.LoadUint64(&m.AddDropSizePreCounter) 205 } 206 207 //AddDropSizeFinished returns true if mock invocations count is ok 208 func (m *DropStorageMock) AddDropSizeFinished() bool { 209 // if expectation series were set then invocations count should be equal to expectations count 210 if len(m.AddDropSizeMock.expectationSeries) > 0 { 211 return atomic.LoadUint64(&m.AddDropSizeCounter) == uint64(len(m.AddDropSizeMock.expectationSeries)) 212 } 213 214 // if main expectation was set then invocations count should be greater than zero 215 if m.AddDropSizeMock.mainExpectation != nil { 216 return atomic.LoadUint64(&m.AddDropSizeCounter) > 0 217 } 218 219 // if func was set then invocations count should be greater than zero 220 if m.AddDropSizeFunc != nil { 221 return atomic.LoadUint64(&m.AddDropSizeCounter) > 0 222 } 223 224 return true 225 } 226 227 type mDropStorageMockCreateDrop struct { 228 mock *DropStorageMock 229 mainExpectation *DropStorageMockCreateDropExpectation 230 expectationSeries []*DropStorageMockCreateDropExpectation 231 } 232 233 type DropStorageMockCreateDropExpectation struct { 234 input *DropStorageMockCreateDropInput 235 result *DropStorageMockCreateDropResult 236 } 237 238 type DropStorageMockCreateDropInput struct { 239 p context.Context 240 p1 core.RecordID 241 p2 core.PulseNumber 242 p3 []byte 243 } 244 245 type DropStorageMockCreateDropResult struct { 246 r *jet.JetDrop 247 r1 [][]byte 248 r2 uint64 249 r3 error 250 } 251 252 //Expect specifies that invocation of DropStorage.CreateDrop is expected from 1 to Infinity times 253 func (m *mDropStorageMockCreateDrop) Expect(p context.Context, p1 core.RecordID, p2 core.PulseNumber, p3 []byte) *mDropStorageMockCreateDrop { 254 m.mock.CreateDropFunc = nil 255 m.expectationSeries = nil 256 257 if m.mainExpectation == nil { 258 m.mainExpectation = &DropStorageMockCreateDropExpectation{} 259 } 260 m.mainExpectation.input = &DropStorageMockCreateDropInput{p, p1, p2, p3} 261 return m 262 } 263 264 //Return specifies results of invocation of DropStorage.CreateDrop 265 func (m *mDropStorageMockCreateDrop) Return(r *jet.JetDrop, r1 [][]byte, r2 uint64, r3 error) *DropStorageMock { 266 m.mock.CreateDropFunc = nil 267 m.expectationSeries = nil 268 269 if m.mainExpectation == nil { 270 m.mainExpectation = &DropStorageMockCreateDropExpectation{} 271 } 272 m.mainExpectation.result = &DropStorageMockCreateDropResult{r, r1, r2, r3} 273 return m.mock 274 } 275 276 //ExpectOnce specifies that invocation of DropStorage.CreateDrop is expected once 277 func (m *mDropStorageMockCreateDrop) ExpectOnce(p context.Context, p1 core.RecordID, p2 core.PulseNumber, p3 []byte) *DropStorageMockCreateDropExpectation { 278 m.mock.CreateDropFunc = nil 279 m.mainExpectation = nil 280 281 expectation := &DropStorageMockCreateDropExpectation{} 282 expectation.input = &DropStorageMockCreateDropInput{p, p1, p2, p3} 283 m.expectationSeries = append(m.expectationSeries, expectation) 284 return expectation 285 } 286 287 func (e *DropStorageMockCreateDropExpectation) Return(r *jet.JetDrop, r1 [][]byte, r2 uint64, r3 error) { 288 e.result = &DropStorageMockCreateDropResult{r, r1, r2, r3} 289 } 290 291 //Set uses given function f as a mock of DropStorage.CreateDrop method 292 func (m *mDropStorageMockCreateDrop) Set(f func(p context.Context, p1 core.RecordID, p2 core.PulseNumber, p3 []byte) (r *jet.JetDrop, r1 [][]byte, r2 uint64, r3 error)) *DropStorageMock { 293 m.mainExpectation = nil 294 m.expectationSeries = nil 295 296 m.mock.CreateDropFunc = f 297 return m.mock 298 } 299 300 //CreateDrop implements github.com/insolar/insolar/ledger/storage.DropStorage interface 301 func (m *DropStorageMock) CreateDrop(p context.Context, p1 core.RecordID, p2 core.PulseNumber, p3 []byte) (r *jet.JetDrop, r1 [][]byte, r2 uint64, r3 error) { 302 counter := atomic.AddUint64(&m.CreateDropPreCounter, 1) 303 defer atomic.AddUint64(&m.CreateDropCounter, 1) 304 305 if len(m.CreateDropMock.expectationSeries) > 0 { 306 if counter > uint64(len(m.CreateDropMock.expectationSeries)) { 307 m.t.Fatalf("Unexpected call to DropStorageMock.CreateDrop. %v %v %v %v", p, p1, p2, p3) 308 return 309 } 310 311 input := m.CreateDropMock.expectationSeries[counter-1].input 312 testify_assert.Equal(m.t, *input, DropStorageMockCreateDropInput{p, p1, p2, p3}, "DropStorage.CreateDrop got unexpected parameters") 313 314 result := m.CreateDropMock.expectationSeries[counter-1].result 315 if result == nil { 316 m.t.Fatal("No results are set for the DropStorageMock.CreateDrop") 317 return 318 } 319 320 r = result.r 321 r1 = result.r1 322 r2 = result.r2 323 r3 = result.r3 324 325 return 326 } 327 328 if m.CreateDropMock.mainExpectation != nil { 329 330 input := m.CreateDropMock.mainExpectation.input 331 if input != nil { 332 testify_assert.Equal(m.t, *input, DropStorageMockCreateDropInput{p, p1, p2, p3}, "DropStorage.CreateDrop got unexpected parameters") 333 } 334 335 result := m.CreateDropMock.mainExpectation.result 336 if result == nil { 337 m.t.Fatal("No results are set for the DropStorageMock.CreateDrop") 338 } 339 340 r = result.r 341 r1 = result.r1 342 r2 = result.r2 343 r3 = result.r3 344 345 return 346 } 347 348 if m.CreateDropFunc == nil { 349 m.t.Fatalf("Unexpected call to DropStorageMock.CreateDrop. %v %v %v %v", p, p1, p2, p3) 350 return 351 } 352 353 return m.CreateDropFunc(p, p1, p2, p3) 354 } 355 356 //CreateDropMinimockCounter returns a count of DropStorageMock.CreateDropFunc invocations 357 func (m *DropStorageMock) CreateDropMinimockCounter() uint64 { 358 return atomic.LoadUint64(&m.CreateDropCounter) 359 } 360 361 //CreateDropMinimockPreCounter returns the value of DropStorageMock.CreateDrop invocations 362 func (m *DropStorageMock) CreateDropMinimockPreCounter() uint64 { 363 return atomic.LoadUint64(&m.CreateDropPreCounter) 364 } 365 366 //CreateDropFinished returns true if mock invocations count is ok 367 func (m *DropStorageMock) CreateDropFinished() bool { 368 // if expectation series were set then invocations count should be equal to expectations count 369 if len(m.CreateDropMock.expectationSeries) > 0 { 370 return atomic.LoadUint64(&m.CreateDropCounter) == uint64(len(m.CreateDropMock.expectationSeries)) 371 } 372 373 // if main expectation was set then invocations count should be greater than zero 374 if m.CreateDropMock.mainExpectation != nil { 375 return atomic.LoadUint64(&m.CreateDropCounter) > 0 376 } 377 378 // if func was set then invocations count should be greater than zero 379 if m.CreateDropFunc != nil { 380 return atomic.LoadUint64(&m.CreateDropCounter) > 0 381 } 382 383 return true 384 } 385 386 type mDropStorageMockGetDrop struct { 387 mock *DropStorageMock 388 mainExpectation *DropStorageMockGetDropExpectation 389 expectationSeries []*DropStorageMockGetDropExpectation 390 } 391 392 type DropStorageMockGetDropExpectation struct { 393 input *DropStorageMockGetDropInput 394 result *DropStorageMockGetDropResult 395 } 396 397 type DropStorageMockGetDropInput struct { 398 p context.Context 399 p1 core.RecordID 400 p2 core.PulseNumber 401 } 402 403 type DropStorageMockGetDropResult struct { 404 r *jet.JetDrop 405 r1 error 406 } 407 408 //Expect specifies that invocation of DropStorage.GetDrop is expected from 1 to Infinity times 409 func (m *mDropStorageMockGetDrop) Expect(p context.Context, p1 core.RecordID, p2 core.PulseNumber) *mDropStorageMockGetDrop { 410 m.mock.GetDropFunc = nil 411 m.expectationSeries = nil 412 413 if m.mainExpectation == nil { 414 m.mainExpectation = &DropStorageMockGetDropExpectation{} 415 } 416 m.mainExpectation.input = &DropStorageMockGetDropInput{p, p1, p2} 417 return m 418 } 419 420 //Return specifies results of invocation of DropStorage.GetDrop 421 func (m *mDropStorageMockGetDrop) Return(r *jet.JetDrop, r1 error) *DropStorageMock { 422 m.mock.GetDropFunc = nil 423 m.expectationSeries = nil 424 425 if m.mainExpectation == nil { 426 m.mainExpectation = &DropStorageMockGetDropExpectation{} 427 } 428 m.mainExpectation.result = &DropStorageMockGetDropResult{r, r1} 429 return m.mock 430 } 431 432 //ExpectOnce specifies that invocation of DropStorage.GetDrop is expected once 433 func (m *mDropStorageMockGetDrop) ExpectOnce(p context.Context, p1 core.RecordID, p2 core.PulseNumber) *DropStorageMockGetDropExpectation { 434 m.mock.GetDropFunc = nil 435 m.mainExpectation = nil 436 437 expectation := &DropStorageMockGetDropExpectation{} 438 expectation.input = &DropStorageMockGetDropInput{p, p1, p2} 439 m.expectationSeries = append(m.expectationSeries, expectation) 440 return expectation 441 } 442 443 func (e *DropStorageMockGetDropExpectation) Return(r *jet.JetDrop, r1 error) { 444 e.result = &DropStorageMockGetDropResult{r, r1} 445 } 446 447 //Set uses given function f as a mock of DropStorage.GetDrop method 448 func (m *mDropStorageMockGetDrop) Set(f func(p context.Context, p1 core.RecordID, p2 core.PulseNumber) (r *jet.JetDrop, r1 error)) *DropStorageMock { 449 m.mainExpectation = nil 450 m.expectationSeries = nil 451 452 m.mock.GetDropFunc = f 453 return m.mock 454 } 455 456 //GetDrop implements github.com/insolar/insolar/ledger/storage.DropStorage interface 457 func (m *DropStorageMock) GetDrop(p context.Context, p1 core.RecordID, p2 core.PulseNumber) (r *jet.JetDrop, r1 error) { 458 counter := atomic.AddUint64(&m.GetDropPreCounter, 1) 459 defer atomic.AddUint64(&m.GetDropCounter, 1) 460 461 if len(m.GetDropMock.expectationSeries) > 0 { 462 if counter > uint64(len(m.GetDropMock.expectationSeries)) { 463 m.t.Fatalf("Unexpected call to DropStorageMock.GetDrop. %v %v %v", p, p1, p2) 464 return 465 } 466 467 input := m.GetDropMock.expectationSeries[counter-1].input 468 testify_assert.Equal(m.t, *input, DropStorageMockGetDropInput{p, p1, p2}, "DropStorage.GetDrop got unexpected parameters") 469 470 result := m.GetDropMock.expectationSeries[counter-1].result 471 if result == nil { 472 m.t.Fatal("No results are set for the DropStorageMock.GetDrop") 473 return 474 } 475 476 r = result.r 477 r1 = result.r1 478 479 return 480 } 481 482 if m.GetDropMock.mainExpectation != nil { 483 484 input := m.GetDropMock.mainExpectation.input 485 if input != nil { 486 testify_assert.Equal(m.t, *input, DropStorageMockGetDropInput{p, p1, p2}, "DropStorage.GetDrop got unexpected parameters") 487 } 488 489 result := m.GetDropMock.mainExpectation.result 490 if result == nil { 491 m.t.Fatal("No results are set for the DropStorageMock.GetDrop") 492 } 493 494 r = result.r 495 r1 = result.r1 496 497 return 498 } 499 500 if m.GetDropFunc == nil { 501 m.t.Fatalf("Unexpected call to DropStorageMock.GetDrop. %v %v %v", p, p1, p2) 502 return 503 } 504 505 return m.GetDropFunc(p, p1, p2) 506 } 507 508 //GetDropMinimockCounter returns a count of DropStorageMock.GetDropFunc invocations 509 func (m *DropStorageMock) GetDropMinimockCounter() uint64 { 510 return atomic.LoadUint64(&m.GetDropCounter) 511 } 512 513 //GetDropMinimockPreCounter returns the value of DropStorageMock.GetDrop invocations 514 func (m *DropStorageMock) GetDropMinimockPreCounter() uint64 { 515 return atomic.LoadUint64(&m.GetDropPreCounter) 516 } 517 518 //GetDropFinished returns true if mock invocations count is ok 519 func (m *DropStorageMock) GetDropFinished() bool { 520 // if expectation series were set then invocations count should be equal to expectations count 521 if len(m.GetDropMock.expectationSeries) > 0 { 522 return atomic.LoadUint64(&m.GetDropCounter) == uint64(len(m.GetDropMock.expectationSeries)) 523 } 524 525 // if main expectation was set then invocations count should be greater than zero 526 if m.GetDropMock.mainExpectation != nil { 527 return atomic.LoadUint64(&m.GetDropCounter) > 0 528 } 529 530 // if func was set then invocations count should be greater than zero 531 if m.GetDropFunc != nil { 532 return atomic.LoadUint64(&m.GetDropCounter) > 0 533 } 534 535 return true 536 } 537 538 type mDropStorageMockGetDropSizeHistory struct { 539 mock *DropStorageMock 540 mainExpectation *DropStorageMockGetDropSizeHistoryExpectation 541 expectationSeries []*DropStorageMockGetDropSizeHistoryExpectation 542 } 543 544 type DropStorageMockGetDropSizeHistoryExpectation struct { 545 input *DropStorageMockGetDropSizeHistoryInput 546 result *DropStorageMockGetDropSizeHistoryResult 547 } 548 549 type DropStorageMockGetDropSizeHistoryInput struct { 550 p context.Context 551 p1 core.RecordID 552 } 553 554 type DropStorageMockGetDropSizeHistoryResult struct { 555 r jet.DropSizeHistory 556 r1 error 557 } 558 559 //Expect specifies that invocation of DropStorage.GetDropSizeHistory is expected from 1 to Infinity times 560 func (m *mDropStorageMockGetDropSizeHistory) Expect(p context.Context, p1 core.RecordID) *mDropStorageMockGetDropSizeHistory { 561 m.mock.GetDropSizeHistoryFunc = nil 562 m.expectationSeries = nil 563 564 if m.mainExpectation == nil { 565 m.mainExpectation = &DropStorageMockGetDropSizeHistoryExpectation{} 566 } 567 m.mainExpectation.input = &DropStorageMockGetDropSizeHistoryInput{p, p1} 568 return m 569 } 570 571 //Return specifies results of invocation of DropStorage.GetDropSizeHistory 572 func (m *mDropStorageMockGetDropSizeHistory) Return(r jet.DropSizeHistory, r1 error) *DropStorageMock { 573 m.mock.GetDropSizeHistoryFunc = nil 574 m.expectationSeries = nil 575 576 if m.mainExpectation == nil { 577 m.mainExpectation = &DropStorageMockGetDropSizeHistoryExpectation{} 578 } 579 m.mainExpectation.result = &DropStorageMockGetDropSizeHistoryResult{r, r1} 580 return m.mock 581 } 582 583 //ExpectOnce specifies that invocation of DropStorage.GetDropSizeHistory is expected once 584 func (m *mDropStorageMockGetDropSizeHistory) ExpectOnce(p context.Context, p1 core.RecordID) *DropStorageMockGetDropSizeHistoryExpectation { 585 m.mock.GetDropSizeHistoryFunc = nil 586 m.mainExpectation = nil 587 588 expectation := &DropStorageMockGetDropSizeHistoryExpectation{} 589 expectation.input = &DropStorageMockGetDropSizeHistoryInput{p, p1} 590 m.expectationSeries = append(m.expectationSeries, expectation) 591 return expectation 592 } 593 594 func (e *DropStorageMockGetDropSizeHistoryExpectation) Return(r jet.DropSizeHistory, r1 error) { 595 e.result = &DropStorageMockGetDropSizeHistoryResult{r, r1} 596 } 597 598 //Set uses given function f as a mock of DropStorage.GetDropSizeHistory method 599 func (m *mDropStorageMockGetDropSizeHistory) Set(f func(p context.Context, p1 core.RecordID) (r jet.DropSizeHistory, r1 error)) *DropStorageMock { 600 m.mainExpectation = nil 601 m.expectationSeries = nil 602 603 m.mock.GetDropSizeHistoryFunc = f 604 return m.mock 605 } 606 607 //GetDropSizeHistory implements github.com/insolar/insolar/ledger/storage.DropStorage interface 608 func (m *DropStorageMock) GetDropSizeHistory(p context.Context, p1 core.RecordID) (r jet.DropSizeHistory, r1 error) { 609 counter := atomic.AddUint64(&m.GetDropSizeHistoryPreCounter, 1) 610 defer atomic.AddUint64(&m.GetDropSizeHistoryCounter, 1) 611 612 if len(m.GetDropSizeHistoryMock.expectationSeries) > 0 { 613 if counter > uint64(len(m.GetDropSizeHistoryMock.expectationSeries)) { 614 m.t.Fatalf("Unexpected call to DropStorageMock.GetDropSizeHistory. %v %v", p, p1) 615 return 616 } 617 618 input := m.GetDropSizeHistoryMock.expectationSeries[counter-1].input 619 testify_assert.Equal(m.t, *input, DropStorageMockGetDropSizeHistoryInput{p, p1}, "DropStorage.GetDropSizeHistory got unexpected parameters") 620 621 result := m.GetDropSizeHistoryMock.expectationSeries[counter-1].result 622 if result == nil { 623 m.t.Fatal("No results are set for the DropStorageMock.GetDropSizeHistory") 624 return 625 } 626 627 r = result.r 628 r1 = result.r1 629 630 return 631 } 632 633 if m.GetDropSizeHistoryMock.mainExpectation != nil { 634 635 input := m.GetDropSizeHistoryMock.mainExpectation.input 636 if input != nil { 637 testify_assert.Equal(m.t, *input, DropStorageMockGetDropSizeHistoryInput{p, p1}, "DropStorage.GetDropSizeHistory got unexpected parameters") 638 } 639 640 result := m.GetDropSizeHistoryMock.mainExpectation.result 641 if result == nil { 642 m.t.Fatal("No results are set for the DropStorageMock.GetDropSizeHistory") 643 } 644 645 r = result.r 646 r1 = result.r1 647 648 return 649 } 650 651 if m.GetDropSizeHistoryFunc == nil { 652 m.t.Fatalf("Unexpected call to DropStorageMock.GetDropSizeHistory. %v %v", p, p1) 653 return 654 } 655 656 return m.GetDropSizeHistoryFunc(p, p1) 657 } 658 659 //GetDropSizeHistoryMinimockCounter returns a count of DropStorageMock.GetDropSizeHistoryFunc invocations 660 func (m *DropStorageMock) GetDropSizeHistoryMinimockCounter() uint64 { 661 return atomic.LoadUint64(&m.GetDropSizeHistoryCounter) 662 } 663 664 //GetDropSizeHistoryMinimockPreCounter returns the value of DropStorageMock.GetDropSizeHistory invocations 665 func (m *DropStorageMock) GetDropSizeHistoryMinimockPreCounter() uint64 { 666 return atomic.LoadUint64(&m.GetDropSizeHistoryPreCounter) 667 } 668 669 //GetDropSizeHistoryFinished returns true if mock invocations count is ok 670 func (m *DropStorageMock) GetDropSizeHistoryFinished() bool { 671 // if expectation series were set then invocations count should be equal to expectations count 672 if len(m.GetDropSizeHistoryMock.expectationSeries) > 0 { 673 return atomic.LoadUint64(&m.GetDropSizeHistoryCounter) == uint64(len(m.GetDropSizeHistoryMock.expectationSeries)) 674 } 675 676 // if main expectation was set then invocations count should be greater than zero 677 if m.GetDropSizeHistoryMock.mainExpectation != nil { 678 return atomic.LoadUint64(&m.GetDropSizeHistoryCounter) > 0 679 } 680 681 // if func was set then invocations count should be greater than zero 682 if m.GetDropSizeHistoryFunc != nil { 683 return atomic.LoadUint64(&m.GetDropSizeHistoryCounter) > 0 684 } 685 686 return true 687 } 688 689 type mDropStorageMockGetJetSizesHistoryDepth struct { 690 mock *DropStorageMock 691 mainExpectation *DropStorageMockGetJetSizesHistoryDepthExpectation 692 expectationSeries []*DropStorageMockGetJetSizesHistoryDepthExpectation 693 } 694 695 type DropStorageMockGetJetSizesHistoryDepthExpectation struct { 696 result *DropStorageMockGetJetSizesHistoryDepthResult 697 } 698 699 type DropStorageMockGetJetSizesHistoryDepthResult struct { 700 r int 701 } 702 703 //Expect specifies that invocation of DropStorage.GetJetSizesHistoryDepth is expected from 1 to Infinity times 704 func (m *mDropStorageMockGetJetSizesHistoryDepth) Expect() *mDropStorageMockGetJetSizesHistoryDepth { 705 m.mock.GetJetSizesHistoryDepthFunc = nil 706 m.expectationSeries = nil 707 708 if m.mainExpectation == nil { 709 m.mainExpectation = &DropStorageMockGetJetSizesHistoryDepthExpectation{} 710 } 711 712 return m 713 } 714 715 //Return specifies results of invocation of DropStorage.GetJetSizesHistoryDepth 716 func (m *mDropStorageMockGetJetSizesHistoryDepth) Return(r int) *DropStorageMock { 717 m.mock.GetJetSizesHistoryDepthFunc = nil 718 m.expectationSeries = nil 719 720 if m.mainExpectation == nil { 721 m.mainExpectation = &DropStorageMockGetJetSizesHistoryDepthExpectation{} 722 } 723 m.mainExpectation.result = &DropStorageMockGetJetSizesHistoryDepthResult{r} 724 return m.mock 725 } 726 727 //ExpectOnce specifies that invocation of DropStorage.GetJetSizesHistoryDepth is expected once 728 func (m *mDropStorageMockGetJetSizesHistoryDepth) ExpectOnce() *DropStorageMockGetJetSizesHistoryDepthExpectation { 729 m.mock.GetJetSizesHistoryDepthFunc = nil 730 m.mainExpectation = nil 731 732 expectation := &DropStorageMockGetJetSizesHistoryDepthExpectation{} 733 734 m.expectationSeries = append(m.expectationSeries, expectation) 735 return expectation 736 } 737 738 func (e *DropStorageMockGetJetSizesHistoryDepthExpectation) Return(r int) { 739 e.result = &DropStorageMockGetJetSizesHistoryDepthResult{r} 740 } 741 742 //Set uses given function f as a mock of DropStorage.GetJetSizesHistoryDepth method 743 func (m *mDropStorageMockGetJetSizesHistoryDepth) Set(f func() (r int)) *DropStorageMock { 744 m.mainExpectation = nil 745 m.expectationSeries = nil 746 747 m.mock.GetJetSizesHistoryDepthFunc = f 748 return m.mock 749 } 750 751 //GetJetSizesHistoryDepth implements github.com/insolar/insolar/ledger/storage.DropStorage interface 752 func (m *DropStorageMock) GetJetSizesHistoryDepth() (r int) { 753 counter := atomic.AddUint64(&m.GetJetSizesHistoryDepthPreCounter, 1) 754 defer atomic.AddUint64(&m.GetJetSizesHistoryDepthCounter, 1) 755 756 if len(m.GetJetSizesHistoryDepthMock.expectationSeries) > 0 { 757 if counter > uint64(len(m.GetJetSizesHistoryDepthMock.expectationSeries)) { 758 m.t.Fatalf("Unexpected call to DropStorageMock.GetJetSizesHistoryDepth.") 759 return 760 } 761 762 result := m.GetJetSizesHistoryDepthMock.expectationSeries[counter-1].result 763 if result == nil { 764 m.t.Fatal("No results are set for the DropStorageMock.GetJetSizesHistoryDepth") 765 return 766 } 767 768 r = result.r 769 770 return 771 } 772 773 if m.GetJetSizesHistoryDepthMock.mainExpectation != nil { 774 775 result := m.GetJetSizesHistoryDepthMock.mainExpectation.result 776 if result == nil { 777 m.t.Fatal("No results are set for the DropStorageMock.GetJetSizesHistoryDepth") 778 } 779 780 r = result.r 781 782 return 783 } 784 785 if m.GetJetSizesHistoryDepthFunc == nil { 786 m.t.Fatalf("Unexpected call to DropStorageMock.GetJetSizesHistoryDepth.") 787 return 788 } 789 790 return m.GetJetSizesHistoryDepthFunc() 791 } 792 793 //GetJetSizesHistoryDepthMinimockCounter returns a count of DropStorageMock.GetJetSizesHistoryDepthFunc invocations 794 func (m *DropStorageMock) GetJetSizesHistoryDepthMinimockCounter() uint64 { 795 return atomic.LoadUint64(&m.GetJetSizesHistoryDepthCounter) 796 } 797 798 //GetJetSizesHistoryDepthMinimockPreCounter returns the value of DropStorageMock.GetJetSizesHistoryDepth invocations 799 func (m *DropStorageMock) GetJetSizesHistoryDepthMinimockPreCounter() uint64 { 800 return atomic.LoadUint64(&m.GetJetSizesHistoryDepthPreCounter) 801 } 802 803 //GetJetSizesHistoryDepthFinished returns true if mock invocations count is ok 804 func (m *DropStorageMock) GetJetSizesHistoryDepthFinished() bool { 805 // if expectation series were set then invocations count should be equal to expectations count 806 if len(m.GetJetSizesHistoryDepthMock.expectationSeries) > 0 { 807 return atomic.LoadUint64(&m.GetJetSizesHistoryDepthCounter) == uint64(len(m.GetJetSizesHistoryDepthMock.expectationSeries)) 808 } 809 810 // if main expectation was set then invocations count should be greater than zero 811 if m.GetJetSizesHistoryDepthMock.mainExpectation != nil { 812 return atomic.LoadUint64(&m.GetJetSizesHistoryDepthCounter) > 0 813 } 814 815 // if func was set then invocations count should be greater than zero 816 if m.GetJetSizesHistoryDepthFunc != nil { 817 return atomic.LoadUint64(&m.GetJetSizesHistoryDepthCounter) > 0 818 } 819 820 return true 821 } 822 823 type mDropStorageMockSetDrop struct { 824 mock *DropStorageMock 825 mainExpectation *DropStorageMockSetDropExpectation 826 expectationSeries []*DropStorageMockSetDropExpectation 827 } 828 829 type DropStorageMockSetDropExpectation struct { 830 input *DropStorageMockSetDropInput 831 result *DropStorageMockSetDropResult 832 } 833 834 type DropStorageMockSetDropInput struct { 835 p context.Context 836 p1 core.RecordID 837 p2 *jet.JetDrop 838 } 839 840 type DropStorageMockSetDropResult struct { 841 r error 842 } 843 844 //Expect specifies that invocation of DropStorage.SetDrop is expected from 1 to Infinity times 845 func (m *mDropStorageMockSetDrop) Expect(p context.Context, p1 core.RecordID, p2 *jet.JetDrop) *mDropStorageMockSetDrop { 846 m.mock.SetDropFunc = nil 847 m.expectationSeries = nil 848 849 if m.mainExpectation == nil { 850 m.mainExpectation = &DropStorageMockSetDropExpectation{} 851 } 852 m.mainExpectation.input = &DropStorageMockSetDropInput{p, p1, p2} 853 return m 854 } 855 856 //Return specifies results of invocation of DropStorage.SetDrop 857 func (m *mDropStorageMockSetDrop) Return(r error) *DropStorageMock { 858 m.mock.SetDropFunc = nil 859 m.expectationSeries = nil 860 861 if m.mainExpectation == nil { 862 m.mainExpectation = &DropStorageMockSetDropExpectation{} 863 } 864 m.mainExpectation.result = &DropStorageMockSetDropResult{r} 865 return m.mock 866 } 867 868 //ExpectOnce specifies that invocation of DropStorage.SetDrop is expected once 869 func (m *mDropStorageMockSetDrop) ExpectOnce(p context.Context, p1 core.RecordID, p2 *jet.JetDrop) *DropStorageMockSetDropExpectation { 870 m.mock.SetDropFunc = nil 871 m.mainExpectation = nil 872 873 expectation := &DropStorageMockSetDropExpectation{} 874 expectation.input = &DropStorageMockSetDropInput{p, p1, p2} 875 m.expectationSeries = append(m.expectationSeries, expectation) 876 return expectation 877 } 878 879 func (e *DropStorageMockSetDropExpectation) Return(r error) { 880 e.result = &DropStorageMockSetDropResult{r} 881 } 882 883 //Set uses given function f as a mock of DropStorage.SetDrop method 884 func (m *mDropStorageMockSetDrop) Set(f func(p context.Context, p1 core.RecordID, p2 *jet.JetDrop) (r error)) *DropStorageMock { 885 m.mainExpectation = nil 886 m.expectationSeries = nil 887 888 m.mock.SetDropFunc = f 889 return m.mock 890 } 891 892 //SetDrop implements github.com/insolar/insolar/ledger/storage.DropStorage interface 893 func (m *DropStorageMock) SetDrop(p context.Context, p1 core.RecordID, p2 *jet.JetDrop) (r error) { 894 counter := atomic.AddUint64(&m.SetDropPreCounter, 1) 895 defer atomic.AddUint64(&m.SetDropCounter, 1) 896 897 if len(m.SetDropMock.expectationSeries) > 0 { 898 if counter > uint64(len(m.SetDropMock.expectationSeries)) { 899 m.t.Fatalf("Unexpected call to DropStorageMock.SetDrop. %v %v %v", p, p1, p2) 900 return 901 } 902 903 input := m.SetDropMock.expectationSeries[counter-1].input 904 testify_assert.Equal(m.t, *input, DropStorageMockSetDropInput{p, p1, p2}, "DropStorage.SetDrop got unexpected parameters") 905 906 result := m.SetDropMock.expectationSeries[counter-1].result 907 if result == nil { 908 m.t.Fatal("No results are set for the DropStorageMock.SetDrop") 909 return 910 } 911 912 r = result.r 913 914 return 915 } 916 917 if m.SetDropMock.mainExpectation != nil { 918 919 input := m.SetDropMock.mainExpectation.input 920 if input != nil { 921 testify_assert.Equal(m.t, *input, DropStorageMockSetDropInput{p, p1, p2}, "DropStorage.SetDrop got unexpected parameters") 922 } 923 924 result := m.SetDropMock.mainExpectation.result 925 if result == nil { 926 m.t.Fatal("No results are set for the DropStorageMock.SetDrop") 927 } 928 929 r = result.r 930 931 return 932 } 933 934 if m.SetDropFunc == nil { 935 m.t.Fatalf("Unexpected call to DropStorageMock.SetDrop. %v %v %v", p, p1, p2) 936 return 937 } 938 939 return m.SetDropFunc(p, p1, p2) 940 } 941 942 //SetDropMinimockCounter returns a count of DropStorageMock.SetDropFunc invocations 943 func (m *DropStorageMock) SetDropMinimockCounter() uint64 { 944 return atomic.LoadUint64(&m.SetDropCounter) 945 } 946 947 //SetDropMinimockPreCounter returns the value of DropStorageMock.SetDrop invocations 948 func (m *DropStorageMock) SetDropMinimockPreCounter() uint64 { 949 return atomic.LoadUint64(&m.SetDropPreCounter) 950 } 951 952 //SetDropFinished returns true if mock invocations count is ok 953 func (m *DropStorageMock) SetDropFinished() bool { 954 // if expectation series were set then invocations count should be equal to expectations count 955 if len(m.SetDropMock.expectationSeries) > 0 { 956 return atomic.LoadUint64(&m.SetDropCounter) == uint64(len(m.SetDropMock.expectationSeries)) 957 } 958 959 // if main expectation was set then invocations count should be greater than zero 960 if m.SetDropMock.mainExpectation != nil { 961 return atomic.LoadUint64(&m.SetDropCounter) > 0 962 } 963 964 // if func was set then invocations count should be greater than zero 965 if m.SetDropFunc != nil { 966 return atomic.LoadUint64(&m.SetDropCounter) > 0 967 } 968 969 return true 970 } 971 972 type mDropStorageMockSetDropSizeHistory struct { 973 mock *DropStorageMock 974 mainExpectation *DropStorageMockSetDropSizeHistoryExpectation 975 expectationSeries []*DropStorageMockSetDropSizeHistoryExpectation 976 } 977 978 type DropStorageMockSetDropSizeHistoryExpectation struct { 979 input *DropStorageMockSetDropSizeHistoryInput 980 result *DropStorageMockSetDropSizeHistoryResult 981 } 982 983 type DropStorageMockSetDropSizeHistoryInput struct { 984 p context.Context 985 p1 core.RecordID 986 p2 jet.DropSizeHistory 987 } 988 989 type DropStorageMockSetDropSizeHistoryResult struct { 990 r error 991 } 992 993 //Expect specifies that invocation of DropStorage.SetDropSizeHistory is expected from 1 to Infinity times 994 func (m *mDropStorageMockSetDropSizeHistory) Expect(p context.Context, p1 core.RecordID, p2 jet.DropSizeHistory) *mDropStorageMockSetDropSizeHistory { 995 m.mock.SetDropSizeHistoryFunc = nil 996 m.expectationSeries = nil 997 998 if m.mainExpectation == nil { 999 m.mainExpectation = &DropStorageMockSetDropSizeHistoryExpectation{} 1000 } 1001 m.mainExpectation.input = &DropStorageMockSetDropSizeHistoryInput{p, p1, p2} 1002 return m 1003 } 1004 1005 //Return specifies results of invocation of DropStorage.SetDropSizeHistory 1006 func (m *mDropStorageMockSetDropSizeHistory) Return(r error) *DropStorageMock { 1007 m.mock.SetDropSizeHistoryFunc = nil 1008 m.expectationSeries = nil 1009 1010 if m.mainExpectation == nil { 1011 m.mainExpectation = &DropStorageMockSetDropSizeHistoryExpectation{} 1012 } 1013 m.mainExpectation.result = &DropStorageMockSetDropSizeHistoryResult{r} 1014 return m.mock 1015 } 1016 1017 //ExpectOnce specifies that invocation of DropStorage.SetDropSizeHistory is expected once 1018 func (m *mDropStorageMockSetDropSizeHistory) ExpectOnce(p context.Context, p1 core.RecordID, p2 jet.DropSizeHistory) *DropStorageMockSetDropSizeHistoryExpectation { 1019 m.mock.SetDropSizeHistoryFunc = nil 1020 m.mainExpectation = nil 1021 1022 expectation := &DropStorageMockSetDropSizeHistoryExpectation{} 1023 expectation.input = &DropStorageMockSetDropSizeHistoryInput{p, p1, p2} 1024 m.expectationSeries = append(m.expectationSeries, expectation) 1025 return expectation 1026 } 1027 1028 func (e *DropStorageMockSetDropSizeHistoryExpectation) Return(r error) { 1029 e.result = &DropStorageMockSetDropSizeHistoryResult{r} 1030 } 1031 1032 //Set uses given function f as a mock of DropStorage.SetDropSizeHistory method 1033 func (m *mDropStorageMockSetDropSizeHistory) Set(f func(p context.Context, p1 core.RecordID, p2 jet.DropSizeHistory) (r error)) *DropStorageMock { 1034 m.mainExpectation = nil 1035 m.expectationSeries = nil 1036 1037 m.mock.SetDropSizeHistoryFunc = f 1038 return m.mock 1039 } 1040 1041 //SetDropSizeHistory implements github.com/insolar/insolar/ledger/storage.DropStorage interface 1042 func (m *DropStorageMock) SetDropSizeHistory(p context.Context, p1 core.RecordID, p2 jet.DropSizeHistory) (r error) { 1043 counter := atomic.AddUint64(&m.SetDropSizeHistoryPreCounter, 1) 1044 defer atomic.AddUint64(&m.SetDropSizeHistoryCounter, 1) 1045 1046 if len(m.SetDropSizeHistoryMock.expectationSeries) > 0 { 1047 if counter > uint64(len(m.SetDropSizeHistoryMock.expectationSeries)) { 1048 m.t.Fatalf("Unexpected call to DropStorageMock.SetDropSizeHistory. %v %v %v", p, p1, p2) 1049 return 1050 } 1051 1052 input := m.SetDropSizeHistoryMock.expectationSeries[counter-1].input 1053 testify_assert.Equal(m.t, *input, DropStorageMockSetDropSizeHistoryInput{p, p1, p2}, "DropStorage.SetDropSizeHistory got unexpected parameters") 1054 1055 result := m.SetDropSizeHistoryMock.expectationSeries[counter-1].result 1056 if result == nil { 1057 m.t.Fatal("No results are set for the DropStorageMock.SetDropSizeHistory") 1058 return 1059 } 1060 1061 r = result.r 1062 1063 return 1064 } 1065 1066 if m.SetDropSizeHistoryMock.mainExpectation != nil { 1067 1068 input := m.SetDropSizeHistoryMock.mainExpectation.input 1069 if input != nil { 1070 testify_assert.Equal(m.t, *input, DropStorageMockSetDropSizeHistoryInput{p, p1, p2}, "DropStorage.SetDropSizeHistory got unexpected parameters") 1071 } 1072 1073 result := m.SetDropSizeHistoryMock.mainExpectation.result 1074 if result == nil { 1075 m.t.Fatal("No results are set for the DropStorageMock.SetDropSizeHistory") 1076 } 1077 1078 r = result.r 1079 1080 return 1081 } 1082 1083 if m.SetDropSizeHistoryFunc == nil { 1084 m.t.Fatalf("Unexpected call to DropStorageMock.SetDropSizeHistory. %v %v %v", p, p1, p2) 1085 return 1086 } 1087 1088 return m.SetDropSizeHistoryFunc(p, p1, p2) 1089 } 1090 1091 //SetDropSizeHistoryMinimockCounter returns a count of DropStorageMock.SetDropSizeHistoryFunc invocations 1092 func (m *DropStorageMock) SetDropSizeHistoryMinimockCounter() uint64 { 1093 return atomic.LoadUint64(&m.SetDropSizeHistoryCounter) 1094 } 1095 1096 //SetDropSizeHistoryMinimockPreCounter returns the value of DropStorageMock.SetDropSizeHistory invocations 1097 func (m *DropStorageMock) SetDropSizeHistoryMinimockPreCounter() uint64 { 1098 return atomic.LoadUint64(&m.SetDropSizeHistoryPreCounter) 1099 } 1100 1101 //SetDropSizeHistoryFinished returns true if mock invocations count is ok 1102 func (m *DropStorageMock) SetDropSizeHistoryFinished() bool { 1103 // if expectation series were set then invocations count should be equal to expectations count 1104 if len(m.SetDropSizeHistoryMock.expectationSeries) > 0 { 1105 return atomic.LoadUint64(&m.SetDropSizeHistoryCounter) == uint64(len(m.SetDropSizeHistoryMock.expectationSeries)) 1106 } 1107 1108 // if main expectation was set then invocations count should be greater than zero 1109 if m.SetDropSizeHistoryMock.mainExpectation != nil { 1110 return atomic.LoadUint64(&m.SetDropSizeHistoryCounter) > 0 1111 } 1112 1113 // if func was set then invocations count should be greater than zero 1114 if m.SetDropSizeHistoryFunc != nil { 1115 return atomic.LoadUint64(&m.SetDropSizeHistoryCounter) > 0 1116 } 1117 1118 return true 1119 } 1120 1121 //ValidateCallCounters checks that all mocked methods of the interface have been called at least once 1122 //Deprecated: please use MinimockFinish method or use Finish method of minimock.Controller 1123 func (m *DropStorageMock) ValidateCallCounters() { 1124 1125 if !m.AddDropSizeFinished() { 1126 m.t.Fatal("Expected call to DropStorageMock.AddDropSize") 1127 } 1128 1129 if !m.CreateDropFinished() { 1130 m.t.Fatal("Expected call to DropStorageMock.CreateDrop") 1131 } 1132 1133 if !m.GetDropFinished() { 1134 m.t.Fatal("Expected call to DropStorageMock.GetDrop") 1135 } 1136 1137 if !m.GetDropSizeHistoryFinished() { 1138 m.t.Fatal("Expected call to DropStorageMock.GetDropSizeHistory") 1139 } 1140 1141 if !m.GetJetSizesHistoryDepthFinished() { 1142 m.t.Fatal("Expected call to DropStorageMock.GetJetSizesHistoryDepth") 1143 } 1144 1145 if !m.SetDropFinished() { 1146 m.t.Fatal("Expected call to DropStorageMock.SetDrop") 1147 } 1148 1149 if !m.SetDropSizeHistoryFinished() { 1150 m.t.Fatal("Expected call to DropStorageMock.SetDropSizeHistory") 1151 } 1152 1153 } 1154 1155 //CheckMocksCalled checks that all mocked methods of the interface have been called at least once 1156 //Deprecated: please use MinimockFinish method or use Finish method of minimock.Controller 1157 func (m *DropStorageMock) CheckMocksCalled() { 1158 m.Finish() 1159 } 1160 1161 //Finish checks that all mocked methods of the interface have been called at least once 1162 //Deprecated: please use MinimockFinish or use Finish method of minimock.Controller 1163 func (m *DropStorageMock) Finish() { 1164 m.MinimockFinish() 1165 } 1166 1167 //MinimockFinish checks that all mocked methods of the interface have been called at least once 1168 func (m *DropStorageMock) MinimockFinish() { 1169 1170 if !m.AddDropSizeFinished() { 1171 m.t.Fatal("Expected call to DropStorageMock.AddDropSize") 1172 } 1173 1174 if !m.CreateDropFinished() { 1175 m.t.Fatal("Expected call to DropStorageMock.CreateDrop") 1176 } 1177 1178 if !m.GetDropFinished() { 1179 m.t.Fatal("Expected call to DropStorageMock.GetDrop") 1180 } 1181 1182 if !m.GetDropSizeHistoryFinished() { 1183 m.t.Fatal("Expected call to DropStorageMock.GetDropSizeHistory") 1184 } 1185 1186 if !m.GetJetSizesHistoryDepthFinished() { 1187 m.t.Fatal("Expected call to DropStorageMock.GetJetSizesHistoryDepth") 1188 } 1189 1190 if !m.SetDropFinished() { 1191 m.t.Fatal("Expected call to DropStorageMock.SetDrop") 1192 } 1193 1194 if !m.SetDropSizeHistoryFinished() { 1195 m.t.Fatal("Expected call to DropStorageMock.SetDropSizeHistory") 1196 } 1197 1198 } 1199 1200 //Wait waits for all mocked methods to be called at least once 1201 //Deprecated: please use MinimockWait or use Wait method of minimock.Controller 1202 func (m *DropStorageMock) Wait(timeout time.Duration) { 1203 m.MinimockWait(timeout) 1204 } 1205 1206 //MinimockWait waits for all mocked methods to be called at least once 1207 //this method is called by minimock.Controller 1208 func (m *DropStorageMock) MinimockWait(timeout time.Duration) { 1209 timeoutCh := time.After(timeout) 1210 for { 1211 ok := true 1212 ok = ok && m.AddDropSizeFinished() 1213 ok = ok && m.CreateDropFinished() 1214 ok = ok && m.GetDropFinished() 1215 ok = ok && m.GetDropSizeHistoryFinished() 1216 ok = ok && m.GetJetSizesHistoryDepthFinished() 1217 ok = ok && m.SetDropFinished() 1218 ok = ok && m.SetDropSizeHistoryFinished() 1219 1220 if ok { 1221 return 1222 } 1223 1224 select { 1225 case <-timeoutCh: 1226 1227 if !m.AddDropSizeFinished() { 1228 m.t.Error("Expected call to DropStorageMock.AddDropSize") 1229 } 1230 1231 if !m.CreateDropFinished() { 1232 m.t.Error("Expected call to DropStorageMock.CreateDrop") 1233 } 1234 1235 if !m.GetDropFinished() { 1236 m.t.Error("Expected call to DropStorageMock.GetDrop") 1237 } 1238 1239 if !m.GetDropSizeHistoryFinished() { 1240 m.t.Error("Expected call to DropStorageMock.GetDropSizeHistory") 1241 } 1242 1243 if !m.GetJetSizesHistoryDepthFinished() { 1244 m.t.Error("Expected call to DropStorageMock.GetJetSizesHistoryDepth") 1245 } 1246 1247 if !m.SetDropFinished() { 1248 m.t.Error("Expected call to DropStorageMock.SetDrop") 1249 } 1250 1251 if !m.SetDropSizeHistoryFinished() { 1252 m.t.Error("Expected call to DropStorageMock.SetDropSizeHistory") 1253 } 1254 1255 m.t.Fatalf("Some mocks were not called on time: %s", timeout) 1256 return 1257 default: 1258 time.Sleep(time.Millisecond) 1259 } 1260 } 1261 } 1262 1263 //AllMocksCalled returns true if all mocked methods were called before the execution of AllMocksCalled, 1264 //it can be used with assert/require, i.e. assert.True(mock.AllMocksCalled()) 1265 func (m *DropStorageMock) AllMocksCalled() bool { 1266 1267 if !m.AddDropSizeFinished() { 1268 return false 1269 } 1270 1271 if !m.CreateDropFinished() { 1272 return false 1273 } 1274 1275 if !m.GetDropFinished() { 1276 return false 1277 } 1278 1279 if !m.GetDropSizeHistoryFinished() { 1280 return false 1281 } 1282 1283 if !m.GetJetSizesHistoryDepthFinished() { 1284 return false 1285 } 1286 1287 if !m.SetDropFinished() { 1288 return false 1289 } 1290 1291 if !m.SetDropSizeHistoryFinished() { 1292 return false 1293 } 1294 1295 return true 1296 }