github.com/braveheart12/insolar-09-08-19@v0.8.7/ledger/recentstorage/recent_index_storage_mock.go (about)

     1  package recentstorage
     2  
     3  /*
     4  DO NOT EDIT!
     5  This code was generated automatically using github.com/gojuno/minimock v1.9
     6  The original interface "RecentIndexStorage" can be found in github.com/insolar/insolar/ledger/recentstorage
     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  
    16  	testify_assert "github.com/stretchr/testify/assert"
    17  )
    18  
    19  //RecentIndexStorageMock implements github.com/insolar/insolar/ledger/recentstorage.RecentIndexStorage
    20  type RecentIndexStorageMock struct {
    21  	t minimock.Tester
    22  
    23  	AddObjectFunc       func(p context.Context, p1 core.RecordID)
    24  	AddObjectCounter    uint64
    25  	AddObjectPreCounter uint64
    26  	AddObjectMock       mRecentIndexStorageMockAddObject
    27  
    28  	AddObjectWithTLLFunc       func(p context.Context, p1 core.RecordID, p2 int)
    29  	AddObjectWithTLLCounter    uint64
    30  	AddObjectWithTLLPreCounter uint64
    31  	AddObjectWithTLLMock       mRecentIndexStorageMockAddObjectWithTLL
    32  
    33  	DecreaseIndexTTLFunc       func(p context.Context) (r []core.RecordID)
    34  	DecreaseIndexTTLCounter    uint64
    35  	DecreaseIndexTTLPreCounter uint64
    36  	DecreaseIndexTTLMock       mRecentIndexStorageMockDecreaseIndexTTL
    37  
    38  	FilterNotExistWithLockFunc       func(p context.Context, p1 []core.RecordID, p2 func(p []core.RecordID))
    39  	FilterNotExistWithLockCounter    uint64
    40  	FilterNotExistWithLockPreCounter uint64
    41  	FilterNotExistWithLockMock       mRecentIndexStorageMockFilterNotExistWithLock
    42  
    43  	GetObjectsFunc       func() (r map[core.RecordID]int)
    44  	GetObjectsCounter    uint64
    45  	GetObjectsPreCounter uint64
    46  	GetObjectsMock       mRecentIndexStorageMockGetObjects
    47  }
    48  
    49  //NewRecentIndexStorageMock returns a mock for github.com/insolar/insolar/ledger/recentstorage.RecentIndexStorage
    50  func NewRecentIndexStorageMock(t minimock.Tester) *RecentIndexStorageMock {
    51  	m := &RecentIndexStorageMock{t: t}
    52  
    53  	if controller, ok := t.(minimock.MockController); ok {
    54  		controller.RegisterMocker(m)
    55  	}
    56  
    57  	m.AddObjectMock = mRecentIndexStorageMockAddObject{mock: m}
    58  	m.AddObjectWithTLLMock = mRecentIndexStorageMockAddObjectWithTLL{mock: m}
    59  	m.DecreaseIndexTTLMock = mRecentIndexStorageMockDecreaseIndexTTL{mock: m}
    60  	m.FilterNotExistWithLockMock = mRecentIndexStorageMockFilterNotExistWithLock{mock: m}
    61  	m.GetObjectsMock = mRecentIndexStorageMockGetObjects{mock: m}
    62  
    63  	return m
    64  }
    65  
    66  type mRecentIndexStorageMockAddObject struct {
    67  	mock              *RecentIndexStorageMock
    68  	mainExpectation   *RecentIndexStorageMockAddObjectExpectation
    69  	expectationSeries []*RecentIndexStorageMockAddObjectExpectation
    70  }
    71  
    72  type RecentIndexStorageMockAddObjectExpectation struct {
    73  	input *RecentIndexStorageMockAddObjectInput
    74  }
    75  
    76  type RecentIndexStorageMockAddObjectInput struct {
    77  	p  context.Context
    78  	p1 core.RecordID
    79  }
    80  
    81  //Expect specifies that invocation of RecentIndexStorage.AddObject is expected from 1 to Infinity times
    82  func (m *mRecentIndexStorageMockAddObject) Expect(p context.Context, p1 core.RecordID) *mRecentIndexStorageMockAddObject {
    83  	m.mock.AddObjectFunc = nil
    84  	m.expectationSeries = nil
    85  
    86  	if m.mainExpectation == nil {
    87  		m.mainExpectation = &RecentIndexStorageMockAddObjectExpectation{}
    88  	}
    89  	m.mainExpectation.input = &RecentIndexStorageMockAddObjectInput{p, p1}
    90  	return m
    91  }
    92  
    93  //Return specifies results of invocation of RecentIndexStorage.AddObject
    94  func (m *mRecentIndexStorageMockAddObject) Return() *RecentIndexStorageMock {
    95  	m.mock.AddObjectFunc = nil
    96  	m.expectationSeries = nil
    97  
    98  	if m.mainExpectation == nil {
    99  		m.mainExpectation = &RecentIndexStorageMockAddObjectExpectation{}
   100  	}
   101  
   102  	return m.mock
   103  }
   104  
   105  //ExpectOnce specifies that invocation of RecentIndexStorage.AddObject is expected once
   106  func (m *mRecentIndexStorageMockAddObject) ExpectOnce(p context.Context, p1 core.RecordID) *RecentIndexStorageMockAddObjectExpectation {
   107  	m.mock.AddObjectFunc = nil
   108  	m.mainExpectation = nil
   109  
   110  	expectation := &RecentIndexStorageMockAddObjectExpectation{}
   111  	expectation.input = &RecentIndexStorageMockAddObjectInput{p, p1}
   112  	m.expectationSeries = append(m.expectationSeries, expectation)
   113  	return expectation
   114  }
   115  
   116  //Set uses given function f as a mock of RecentIndexStorage.AddObject method
   117  func (m *mRecentIndexStorageMockAddObject) Set(f func(p context.Context, p1 core.RecordID)) *RecentIndexStorageMock {
   118  	m.mainExpectation = nil
   119  	m.expectationSeries = nil
   120  
   121  	m.mock.AddObjectFunc = f
   122  	return m.mock
   123  }
   124  
   125  //AddObject implements github.com/insolar/insolar/ledger/recentstorage.RecentIndexStorage interface
   126  func (m *RecentIndexStorageMock) AddObject(p context.Context, p1 core.RecordID) {
   127  	counter := atomic.AddUint64(&m.AddObjectPreCounter, 1)
   128  	defer atomic.AddUint64(&m.AddObjectCounter, 1)
   129  
   130  	if len(m.AddObjectMock.expectationSeries) > 0 {
   131  		if counter > uint64(len(m.AddObjectMock.expectationSeries)) {
   132  			m.t.Fatalf("Unexpected call to RecentIndexStorageMock.AddObject. %v %v", p, p1)
   133  			return
   134  		}
   135  
   136  		input := m.AddObjectMock.expectationSeries[counter-1].input
   137  		testify_assert.Equal(m.t, *input, RecentIndexStorageMockAddObjectInput{p, p1}, "RecentIndexStorage.AddObject got unexpected parameters")
   138  
   139  		return
   140  	}
   141  
   142  	if m.AddObjectMock.mainExpectation != nil {
   143  
   144  		input := m.AddObjectMock.mainExpectation.input
   145  		if input != nil {
   146  			testify_assert.Equal(m.t, *input, RecentIndexStorageMockAddObjectInput{p, p1}, "RecentIndexStorage.AddObject got unexpected parameters")
   147  		}
   148  
   149  		return
   150  	}
   151  
   152  	if m.AddObjectFunc == nil {
   153  		m.t.Fatalf("Unexpected call to RecentIndexStorageMock.AddObject. %v %v", p, p1)
   154  		return
   155  	}
   156  
   157  	m.AddObjectFunc(p, p1)
   158  }
   159  
   160  //AddObjectMinimockCounter returns a count of RecentIndexStorageMock.AddObjectFunc invocations
   161  func (m *RecentIndexStorageMock) AddObjectMinimockCounter() uint64 {
   162  	return atomic.LoadUint64(&m.AddObjectCounter)
   163  }
   164  
   165  //AddObjectMinimockPreCounter returns the value of RecentIndexStorageMock.AddObject invocations
   166  func (m *RecentIndexStorageMock) AddObjectMinimockPreCounter() uint64 {
   167  	return atomic.LoadUint64(&m.AddObjectPreCounter)
   168  }
   169  
   170  //AddObjectFinished returns true if mock invocations count is ok
   171  func (m *RecentIndexStorageMock) AddObjectFinished() bool {
   172  	// if expectation series were set then invocations count should be equal to expectations count
   173  	if len(m.AddObjectMock.expectationSeries) > 0 {
   174  		return atomic.LoadUint64(&m.AddObjectCounter) == uint64(len(m.AddObjectMock.expectationSeries))
   175  	}
   176  
   177  	// if main expectation was set then invocations count should be greater than zero
   178  	if m.AddObjectMock.mainExpectation != nil {
   179  		return atomic.LoadUint64(&m.AddObjectCounter) > 0
   180  	}
   181  
   182  	// if func was set then invocations count should be greater than zero
   183  	if m.AddObjectFunc != nil {
   184  		return atomic.LoadUint64(&m.AddObjectCounter) > 0
   185  	}
   186  
   187  	return true
   188  }
   189  
   190  type mRecentIndexStorageMockAddObjectWithTLL struct {
   191  	mock              *RecentIndexStorageMock
   192  	mainExpectation   *RecentIndexStorageMockAddObjectWithTLLExpectation
   193  	expectationSeries []*RecentIndexStorageMockAddObjectWithTLLExpectation
   194  }
   195  
   196  type RecentIndexStorageMockAddObjectWithTLLExpectation struct {
   197  	input *RecentIndexStorageMockAddObjectWithTLLInput
   198  }
   199  
   200  type RecentIndexStorageMockAddObjectWithTLLInput struct {
   201  	p  context.Context
   202  	p1 core.RecordID
   203  	p2 int
   204  }
   205  
   206  //Expect specifies that invocation of RecentIndexStorage.AddObjectWithTLL is expected from 1 to Infinity times
   207  func (m *mRecentIndexStorageMockAddObjectWithTLL) Expect(p context.Context, p1 core.RecordID, p2 int) *mRecentIndexStorageMockAddObjectWithTLL {
   208  	m.mock.AddObjectWithTLLFunc = nil
   209  	m.expectationSeries = nil
   210  
   211  	if m.mainExpectation == nil {
   212  		m.mainExpectation = &RecentIndexStorageMockAddObjectWithTLLExpectation{}
   213  	}
   214  	m.mainExpectation.input = &RecentIndexStorageMockAddObjectWithTLLInput{p, p1, p2}
   215  	return m
   216  }
   217  
   218  //Return specifies results of invocation of RecentIndexStorage.AddObjectWithTLL
   219  func (m *mRecentIndexStorageMockAddObjectWithTLL) Return() *RecentIndexStorageMock {
   220  	m.mock.AddObjectWithTLLFunc = nil
   221  	m.expectationSeries = nil
   222  
   223  	if m.mainExpectation == nil {
   224  		m.mainExpectation = &RecentIndexStorageMockAddObjectWithTLLExpectation{}
   225  	}
   226  
   227  	return m.mock
   228  }
   229  
   230  //ExpectOnce specifies that invocation of RecentIndexStorage.AddObjectWithTLL is expected once
   231  func (m *mRecentIndexStorageMockAddObjectWithTLL) ExpectOnce(p context.Context, p1 core.RecordID, p2 int) *RecentIndexStorageMockAddObjectWithTLLExpectation {
   232  	m.mock.AddObjectWithTLLFunc = nil
   233  	m.mainExpectation = nil
   234  
   235  	expectation := &RecentIndexStorageMockAddObjectWithTLLExpectation{}
   236  	expectation.input = &RecentIndexStorageMockAddObjectWithTLLInput{p, p1, p2}
   237  	m.expectationSeries = append(m.expectationSeries, expectation)
   238  	return expectation
   239  }
   240  
   241  //Set uses given function f as a mock of RecentIndexStorage.AddObjectWithTLL method
   242  func (m *mRecentIndexStorageMockAddObjectWithTLL) Set(f func(p context.Context, p1 core.RecordID, p2 int)) *RecentIndexStorageMock {
   243  	m.mainExpectation = nil
   244  	m.expectationSeries = nil
   245  
   246  	m.mock.AddObjectWithTLLFunc = f
   247  	return m.mock
   248  }
   249  
   250  //AddObjectWithTLL implements github.com/insolar/insolar/ledger/recentstorage.RecentIndexStorage interface
   251  func (m *RecentIndexStorageMock) AddObjectWithTLL(p context.Context, p1 core.RecordID, p2 int) {
   252  	counter := atomic.AddUint64(&m.AddObjectWithTLLPreCounter, 1)
   253  	defer atomic.AddUint64(&m.AddObjectWithTLLCounter, 1)
   254  
   255  	if len(m.AddObjectWithTLLMock.expectationSeries) > 0 {
   256  		if counter > uint64(len(m.AddObjectWithTLLMock.expectationSeries)) {
   257  			m.t.Fatalf("Unexpected call to RecentIndexStorageMock.AddObjectWithTLL. %v %v %v", p, p1, p2)
   258  			return
   259  		}
   260  
   261  		input := m.AddObjectWithTLLMock.expectationSeries[counter-1].input
   262  		testify_assert.Equal(m.t, *input, RecentIndexStorageMockAddObjectWithTLLInput{p, p1, p2}, "RecentIndexStorage.AddObjectWithTLL got unexpected parameters")
   263  
   264  		return
   265  	}
   266  
   267  	if m.AddObjectWithTLLMock.mainExpectation != nil {
   268  
   269  		input := m.AddObjectWithTLLMock.mainExpectation.input
   270  		if input != nil {
   271  			testify_assert.Equal(m.t, *input, RecentIndexStorageMockAddObjectWithTLLInput{p, p1, p2}, "RecentIndexStorage.AddObjectWithTLL got unexpected parameters")
   272  		}
   273  
   274  		return
   275  	}
   276  
   277  	if m.AddObjectWithTLLFunc == nil {
   278  		m.t.Fatalf("Unexpected call to RecentIndexStorageMock.AddObjectWithTLL. %v %v %v", p, p1, p2)
   279  		return
   280  	}
   281  
   282  	m.AddObjectWithTLLFunc(p, p1, p2)
   283  }
   284  
   285  //AddObjectWithTLLMinimockCounter returns a count of RecentIndexStorageMock.AddObjectWithTLLFunc invocations
   286  func (m *RecentIndexStorageMock) AddObjectWithTLLMinimockCounter() uint64 {
   287  	return atomic.LoadUint64(&m.AddObjectWithTLLCounter)
   288  }
   289  
   290  //AddObjectWithTLLMinimockPreCounter returns the value of RecentIndexStorageMock.AddObjectWithTLL invocations
   291  func (m *RecentIndexStorageMock) AddObjectWithTLLMinimockPreCounter() uint64 {
   292  	return atomic.LoadUint64(&m.AddObjectWithTLLPreCounter)
   293  }
   294  
   295  //AddObjectWithTLLFinished returns true if mock invocations count is ok
   296  func (m *RecentIndexStorageMock) AddObjectWithTLLFinished() bool {
   297  	// if expectation series were set then invocations count should be equal to expectations count
   298  	if len(m.AddObjectWithTLLMock.expectationSeries) > 0 {
   299  		return atomic.LoadUint64(&m.AddObjectWithTLLCounter) == uint64(len(m.AddObjectWithTLLMock.expectationSeries))
   300  	}
   301  
   302  	// if main expectation was set then invocations count should be greater than zero
   303  	if m.AddObjectWithTLLMock.mainExpectation != nil {
   304  		return atomic.LoadUint64(&m.AddObjectWithTLLCounter) > 0
   305  	}
   306  
   307  	// if func was set then invocations count should be greater than zero
   308  	if m.AddObjectWithTLLFunc != nil {
   309  		return atomic.LoadUint64(&m.AddObjectWithTLLCounter) > 0
   310  	}
   311  
   312  	return true
   313  }
   314  
   315  type mRecentIndexStorageMockDecreaseIndexTTL struct {
   316  	mock              *RecentIndexStorageMock
   317  	mainExpectation   *RecentIndexStorageMockDecreaseIndexTTLExpectation
   318  	expectationSeries []*RecentIndexStorageMockDecreaseIndexTTLExpectation
   319  }
   320  
   321  type RecentIndexStorageMockDecreaseIndexTTLExpectation struct {
   322  	input  *RecentIndexStorageMockDecreaseIndexTTLInput
   323  	result *RecentIndexStorageMockDecreaseIndexTTLResult
   324  }
   325  
   326  type RecentIndexStorageMockDecreaseIndexTTLInput struct {
   327  	p context.Context
   328  }
   329  
   330  type RecentIndexStorageMockDecreaseIndexTTLResult struct {
   331  	r []core.RecordID
   332  }
   333  
   334  //Expect specifies that invocation of RecentIndexStorage.DecreaseIndexTTL is expected from 1 to Infinity times
   335  func (m *mRecentIndexStorageMockDecreaseIndexTTL) Expect(p context.Context) *mRecentIndexStorageMockDecreaseIndexTTL {
   336  	m.mock.DecreaseIndexTTLFunc = nil
   337  	m.expectationSeries = nil
   338  
   339  	if m.mainExpectation == nil {
   340  		m.mainExpectation = &RecentIndexStorageMockDecreaseIndexTTLExpectation{}
   341  	}
   342  	m.mainExpectation.input = &RecentIndexStorageMockDecreaseIndexTTLInput{p}
   343  	return m
   344  }
   345  
   346  //Return specifies results of invocation of RecentIndexStorage.DecreaseIndexTTL
   347  func (m *mRecentIndexStorageMockDecreaseIndexTTL) Return(r []core.RecordID) *RecentIndexStorageMock {
   348  	m.mock.DecreaseIndexTTLFunc = nil
   349  	m.expectationSeries = nil
   350  
   351  	if m.mainExpectation == nil {
   352  		m.mainExpectation = &RecentIndexStorageMockDecreaseIndexTTLExpectation{}
   353  	}
   354  	m.mainExpectation.result = &RecentIndexStorageMockDecreaseIndexTTLResult{r}
   355  	return m.mock
   356  }
   357  
   358  //ExpectOnce specifies that invocation of RecentIndexStorage.DecreaseIndexTTL is expected once
   359  func (m *mRecentIndexStorageMockDecreaseIndexTTL) ExpectOnce(p context.Context) *RecentIndexStorageMockDecreaseIndexTTLExpectation {
   360  	m.mock.DecreaseIndexTTLFunc = nil
   361  	m.mainExpectation = nil
   362  
   363  	expectation := &RecentIndexStorageMockDecreaseIndexTTLExpectation{}
   364  	expectation.input = &RecentIndexStorageMockDecreaseIndexTTLInput{p}
   365  	m.expectationSeries = append(m.expectationSeries, expectation)
   366  	return expectation
   367  }
   368  
   369  func (e *RecentIndexStorageMockDecreaseIndexTTLExpectation) Return(r []core.RecordID) {
   370  	e.result = &RecentIndexStorageMockDecreaseIndexTTLResult{r}
   371  }
   372  
   373  //Set uses given function f as a mock of RecentIndexStorage.DecreaseIndexTTL method
   374  func (m *mRecentIndexStorageMockDecreaseIndexTTL) Set(f func(p context.Context) (r []core.RecordID)) *RecentIndexStorageMock {
   375  	m.mainExpectation = nil
   376  	m.expectationSeries = nil
   377  
   378  	m.mock.DecreaseIndexTTLFunc = f
   379  	return m.mock
   380  }
   381  
   382  //DecreaseIndexTTL implements github.com/insolar/insolar/ledger/recentstorage.RecentIndexStorage interface
   383  func (m *RecentIndexStorageMock) DecreaseIndexTTL(p context.Context) (r []core.RecordID) {
   384  	counter := atomic.AddUint64(&m.DecreaseIndexTTLPreCounter, 1)
   385  	defer atomic.AddUint64(&m.DecreaseIndexTTLCounter, 1)
   386  
   387  	if len(m.DecreaseIndexTTLMock.expectationSeries) > 0 {
   388  		if counter > uint64(len(m.DecreaseIndexTTLMock.expectationSeries)) {
   389  			m.t.Fatalf("Unexpected call to RecentIndexStorageMock.DecreaseIndexTTL. %v", p)
   390  			return
   391  		}
   392  
   393  		input := m.DecreaseIndexTTLMock.expectationSeries[counter-1].input
   394  		testify_assert.Equal(m.t, *input, RecentIndexStorageMockDecreaseIndexTTLInput{p}, "RecentIndexStorage.DecreaseIndexTTL got unexpected parameters")
   395  
   396  		result := m.DecreaseIndexTTLMock.expectationSeries[counter-1].result
   397  		if result == nil {
   398  			m.t.Fatal("No results are set for the RecentIndexStorageMock.DecreaseIndexTTL")
   399  			return
   400  		}
   401  
   402  		r = result.r
   403  
   404  		return
   405  	}
   406  
   407  	if m.DecreaseIndexTTLMock.mainExpectation != nil {
   408  
   409  		input := m.DecreaseIndexTTLMock.mainExpectation.input
   410  		if input != nil {
   411  			testify_assert.Equal(m.t, *input, RecentIndexStorageMockDecreaseIndexTTLInput{p}, "RecentIndexStorage.DecreaseIndexTTL got unexpected parameters")
   412  		}
   413  
   414  		result := m.DecreaseIndexTTLMock.mainExpectation.result
   415  		if result == nil {
   416  			m.t.Fatal("No results are set for the RecentIndexStorageMock.DecreaseIndexTTL")
   417  		}
   418  
   419  		r = result.r
   420  
   421  		return
   422  	}
   423  
   424  	if m.DecreaseIndexTTLFunc == nil {
   425  		m.t.Fatalf("Unexpected call to RecentIndexStorageMock.DecreaseIndexTTL. %v", p)
   426  		return
   427  	}
   428  
   429  	return m.DecreaseIndexTTLFunc(p)
   430  }
   431  
   432  //DecreaseIndexTTLMinimockCounter returns a count of RecentIndexStorageMock.DecreaseIndexTTLFunc invocations
   433  func (m *RecentIndexStorageMock) DecreaseIndexTTLMinimockCounter() uint64 {
   434  	return atomic.LoadUint64(&m.DecreaseIndexTTLCounter)
   435  }
   436  
   437  //DecreaseIndexTTLMinimockPreCounter returns the value of RecentIndexStorageMock.DecreaseIndexTTL invocations
   438  func (m *RecentIndexStorageMock) DecreaseIndexTTLMinimockPreCounter() uint64 {
   439  	return atomic.LoadUint64(&m.DecreaseIndexTTLPreCounter)
   440  }
   441  
   442  //DecreaseIndexTTLFinished returns true if mock invocations count is ok
   443  func (m *RecentIndexStorageMock) DecreaseIndexTTLFinished() bool {
   444  	// if expectation series were set then invocations count should be equal to expectations count
   445  	if len(m.DecreaseIndexTTLMock.expectationSeries) > 0 {
   446  		return atomic.LoadUint64(&m.DecreaseIndexTTLCounter) == uint64(len(m.DecreaseIndexTTLMock.expectationSeries))
   447  	}
   448  
   449  	// if main expectation was set then invocations count should be greater than zero
   450  	if m.DecreaseIndexTTLMock.mainExpectation != nil {
   451  		return atomic.LoadUint64(&m.DecreaseIndexTTLCounter) > 0
   452  	}
   453  
   454  	// if func was set then invocations count should be greater than zero
   455  	if m.DecreaseIndexTTLFunc != nil {
   456  		return atomic.LoadUint64(&m.DecreaseIndexTTLCounter) > 0
   457  	}
   458  
   459  	return true
   460  }
   461  
   462  type mRecentIndexStorageMockFilterNotExistWithLock struct {
   463  	mock              *RecentIndexStorageMock
   464  	mainExpectation   *RecentIndexStorageMockFilterNotExistWithLockExpectation
   465  	expectationSeries []*RecentIndexStorageMockFilterNotExistWithLockExpectation
   466  }
   467  
   468  type RecentIndexStorageMockFilterNotExistWithLockExpectation struct {
   469  	input *RecentIndexStorageMockFilterNotExistWithLockInput
   470  }
   471  
   472  type RecentIndexStorageMockFilterNotExistWithLockInput struct {
   473  	p  context.Context
   474  	p1 []core.RecordID
   475  	p2 func(p []core.RecordID)
   476  }
   477  
   478  //Expect specifies that invocation of RecentIndexStorage.FilterNotExistWithLock is expected from 1 to Infinity times
   479  func (m *mRecentIndexStorageMockFilterNotExistWithLock) Expect(p context.Context, p1 []core.RecordID, p2 func(p []core.RecordID)) *mRecentIndexStorageMockFilterNotExistWithLock {
   480  	m.mock.FilterNotExistWithLockFunc = nil
   481  	m.expectationSeries = nil
   482  
   483  	if m.mainExpectation == nil {
   484  		m.mainExpectation = &RecentIndexStorageMockFilterNotExistWithLockExpectation{}
   485  	}
   486  	m.mainExpectation.input = &RecentIndexStorageMockFilterNotExistWithLockInput{p, p1, p2}
   487  	return m
   488  }
   489  
   490  //Return specifies results of invocation of RecentIndexStorage.FilterNotExistWithLock
   491  func (m *mRecentIndexStorageMockFilterNotExistWithLock) Return() *RecentIndexStorageMock {
   492  	m.mock.FilterNotExistWithLockFunc = nil
   493  	m.expectationSeries = nil
   494  
   495  	if m.mainExpectation == nil {
   496  		m.mainExpectation = &RecentIndexStorageMockFilterNotExistWithLockExpectation{}
   497  	}
   498  
   499  	return m.mock
   500  }
   501  
   502  //ExpectOnce specifies that invocation of RecentIndexStorage.FilterNotExistWithLock is expected once
   503  func (m *mRecentIndexStorageMockFilterNotExistWithLock) ExpectOnce(p context.Context, p1 []core.RecordID, p2 func(p []core.RecordID)) *RecentIndexStorageMockFilterNotExistWithLockExpectation {
   504  	m.mock.FilterNotExistWithLockFunc = nil
   505  	m.mainExpectation = nil
   506  
   507  	expectation := &RecentIndexStorageMockFilterNotExistWithLockExpectation{}
   508  	expectation.input = &RecentIndexStorageMockFilterNotExistWithLockInput{p, p1, p2}
   509  	m.expectationSeries = append(m.expectationSeries, expectation)
   510  	return expectation
   511  }
   512  
   513  //Set uses given function f as a mock of RecentIndexStorage.FilterNotExistWithLock method
   514  func (m *mRecentIndexStorageMockFilterNotExistWithLock) Set(f func(p context.Context, p1 []core.RecordID, p2 func(p []core.RecordID))) *RecentIndexStorageMock {
   515  	m.mainExpectation = nil
   516  	m.expectationSeries = nil
   517  
   518  	m.mock.FilterNotExistWithLockFunc = f
   519  	return m.mock
   520  }
   521  
   522  //FilterNotExistWithLock implements github.com/insolar/insolar/ledger/recentstorage.RecentIndexStorage interface
   523  func (m *RecentIndexStorageMock) FilterNotExistWithLock(p context.Context, p1 []core.RecordID, p2 func(p []core.RecordID)) {
   524  	counter := atomic.AddUint64(&m.FilterNotExistWithLockPreCounter, 1)
   525  	defer atomic.AddUint64(&m.FilterNotExistWithLockCounter, 1)
   526  
   527  	if len(m.FilterNotExistWithLockMock.expectationSeries) > 0 {
   528  		if counter > uint64(len(m.FilterNotExistWithLockMock.expectationSeries)) {
   529  			m.t.Fatalf("Unexpected call to RecentIndexStorageMock.FilterNotExistWithLock. %v %v %v", p, p1, p2)
   530  			return
   531  		}
   532  
   533  		input := m.FilterNotExistWithLockMock.expectationSeries[counter-1].input
   534  		testify_assert.Equal(m.t, *input, RecentIndexStorageMockFilterNotExistWithLockInput{p, p1, p2}, "RecentIndexStorage.FilterNotExistWithLock got unexpected parameters")
   535  
   536  		return
   537  	}
   538  
   539  	if m.FilterNotExistWithLockMock.mainExpectation != nil {
   540  
   541  		input := m.FilterNotExistWithLockMock.mainExpectation.input
   542  		if input != nil {
   543  			testify_assert.Equal(m.t, *input, RecentIndexStorageMockFilterNotExistWithLockInput{p, p1, p2}, "RecentIndexStorage.FilterNotExistWithLock got unexpected parameters")
   544  		}
   545  
   546  		return
   547  	}
   548  
   549  	if m.FilterNotExistWithLockFunc == nil {
   550  		m.t.Fatalf("Unexpected call to RecentIndexStorageMock.FilterNotExistWithLock. %v %v %v", p, p1, p2)
   551  		return
   552  	}
   553  
   554  	m.FilterNotExistWithLockFunc(p, p1, p2)
   555  }
   556  
   557  //FilterNotExistWithLockMinimockCounter returns a count of RecentIndexStorageMock.FilterNotExistWithLockFunc invocations
   558  func (m *RecentIndexStorageMock) FilterNotExistWithLockMinimockCounter() uint64 {
   559  	return atomic.LoadUint64(&m.FilterNotExistWithLockCounter)
   560  }
   561  
   562  //FilterNotExistWithLockMinimockPreCounter returns the value of RecentIndexStorageMock.FilterNotExistWithLock invocations
   563  func (m *RecentIndexStorageMock) FilterNotExistWithLockMinimockPreCounter() uint64 {
   564  	return atomic.LoadUint64(&m.FilterNotExistWithLockPreCounter)
   565  }
   566  
   567  //FilterNotExistWithLockFinished returns true if mock invocations count is ok
   568  func (m *RecentIndexStorageMock) FilterNotExistWithLockFinished() bool {
   569  	// if expectation series were set then invocations count should be equal to expectations count
   570  	if len(m.FilterNotExistWithLockMock.expectationSeries) > 0 {
   571  		return atomic.LoadUint64(&m.FilterNotExistWithLockCounter) == uint64(len(m.FilterNotExistWithLockMock.expectationSeries))
   572  	}
   573  
   574  	// if main expectation was set then invocations count should be greater than zero
   575  	if m.FilterNotExistWithLockMock.mainExpectation != nil {
   576  		return atomic.LoadUint64(&m.FilterNotExistWithLockCounter) > 0
   577  	}
   578  
   579  	// if func was set then invocations count should be greater than zero
   580  	if m.FilterNotExistWithLockFunc != nil {
   581  		return atomic.LoadUint64(&m.FilterNotExistWithLockCounter) > 0
   582  	}
   583  
   584  	return true
   585  }
   586  
   587  type mRecentIndexStorageMockGetObjects struct {
   588  	mock              *RecentIndexStorageMock
   589  	mainExpectation   *RecentIndexStorageMockGetObjectsExpectation
   590  	expectationSeries []*RecentIndexStorageMockGetObjectsExpectation
   591  }
   592  
   593  type RecentIndexStorageMockGetObjectsExpectation struct {
   594  	result *RecentIndexStorageMockGetObjectsResult
   595  }
   596  
   597  type RecentIndexStorageMockGetObjectsResult struct {
   598  	r map[core.RecordID]int
   599  }
   600  
   601  //Expect specifies that invocation of RecentIndexStorage.GetObjects is expected from 1 to Infinity times
   602  func (m *mRecentIndexStorageMockGetObjects) Expect() *mRecentIndexStorageMockGetObjects {
   603  	m.mock.GetObjectsFunc = nil
   604  	m.expectationSeries = nil
   605  
   606  	if m.mainExpectation == nil {
   607  		m.mainExpectation = &RecentIndexStorageMockGetObjectsExpectation{}
   608  	}
   609  
   610  	return m
   611  }
   612  
   613  //Return specifies results of invocation of RecentIndexStorage.GetObjects
   614  func (m *mRecentIndexStorageMockGetObjects) Return(r map[core.RecordID]int) *RecentIndexStorageMock {
   615  	m.mock.GetObjectsFunc = nil
   616  	m.expectationSeries = nil
   617  
   618  	if m.mainExpectation == nil {
   619  		m.mainExpectation = &RecentIndexStorageMockGetObjectsExpectation{}
   620  	}
   621  	m.mainExpectation.result = &RecentIndexStorageMockGetObjectsResult{r}
   622  	return m.mock
   623  }
   624  
   625  //ExpectOnce specifies that invocation of RecentIndexStorage.GetObjects is expected once
   626  func (m *mRecentIndexStorageMockGetObjects) ExpectOnce() *RecentIndexStorageMockGetObjectsExpectation {
   627  	m.mock.GetObjectsFunc = nil
   628  	m.mainExpectation = nil
   629  
   630  	expectation := &RecentIndexStorageMockGetObjectsExpectation{}
   631  
   632  	m.expectationSeries = append(m.expectationSeries, expectation)
   633  	return expectation
   634  }
   635  
   636  func (e *RecentIndexStorageMockGetObjectsExpectation) Return(r map[core.RecordID]int) {
   637  	e.result = &RecentIndexStorageMockGetObjectsResult{r}
   638  }
   639  
   640  //Set uses given function f as a mock of RecentIndexStorage.GetObjects method
   641  func (m *mRecentIndexStorageMockGetObjects) Set(f func() (r map[core.RecordID]int)) *RecentIndexStorageMock {
   642  	m.mainExpectation = nil
   643  	m.expectationSeries = nil
   644  
   645  	m.mock.GetObjectsFunc = f
   646  	return m.mock
   647  }
   648  
   649  //GetObjects implements github.com/insolar/insolar/ledger/recentstorage.RecentIndexStorage interface
   650  func (m *RecentIndexStorageMock) GetObjects() (r map[core.RecordID]int) {
   651  	counter := atomic.AddUint64(&m.GetObjectsPreCounter, 1)
   652  	defer atomic.AddUint64(&m.GetObjectsCounter, 1)
   653  
   654  	if len(m.GetObjectsMock.expectationSeries) > 0 {
   655  		if counter > uint64(len(m.GetObjectsMock.expectationSeries)) {
   656  			m.t.Fatalf("Unexpected call to RecentIndexStorageMock.GetObjects.")
   657  			return
   658  		}
   659  
   660  		result := m.GetObjectsMock.expectationSeries[counter-1].result
   661  		if result == nil {
   662  			m.t.Fatal("No results are set for the RecentIndexStorageMock.GetObjects")
   663  			return
   664  		}
   665  
   666  		r = result.r
   667  
   668  		return
   669  	}
   670  
   671  	if m.GetObjectsMock.mainExpectation != nil {
   672  
   673  		result := m.GetObjectsMock.mainExpectation.result
   674  		if result == nil {
   675  			m.t.Fatal("No results are set for the RecentIndexStorageMock.GetObjects")
   676  		}
   677  
   678  		r = result.r
   679  
   680  		return
   681  	}
   682  
   683  	if m.GetObjectsFunc == nil {
   684  		m.t.Fatalf("Unexpected call to RecentIndexStorageMock.GetObjects.")
   685  		return
   686  	}
   687  
   688  	return m.GetObjectsFunc()
   689  }
   690  
   691  //GetObjectsMinimockCounter returns a count of RecentIndexStorageMock.GetObjectsFunc invocations
   692  func (m *RecentIndexStorageMock) GetObjectsMinimockCounter() uint64 {
   693  	return atomic.LoadUint64(&m.GetObjectsCounter)
   694  }
   695  
   696  //GetObjectsMinimockPreCounter returns the value of RecentIndexStorageMock.GetObjects invocations
   697  func (m *RecentIndexStorageMock) GetObjectsMinimockPreCounter() uint64 {
   698  	return atomic.LoadUint64(&m.GetObjectsPreCounter)
   699  }
   700  
   701  //GetObjectsFinished returns true if mock invocations count is ok
   702  func (m *RecentIndexStorageMock) GetObjectsFinished() bool {
   703  	// if expectation series were set then invocations count should be equal to expectations count
   704  	if len(m.GetObjectsMock.expectationSeries) > 0 {
   705  		return atomic.LoadUint64(&m.GetObjectsCounter) == uint64(len(m.GetObjectsMock.expectationSeries))
   706  	}
   707  
   708  	// if main expectation was set then invocations count should be greater than zero
   709  	if m.GetObjectsMock.mainExpectation != nil {
   710  		return atomic.LoadUint64(&m.GetObjectsCounter) > 0
   711  	}
   712  
   713  	// if func was set then invocations count should be greater than zero
   714  	if m.GetObjectsFunc != nil {
   715  		return atomic.LoadUint64(&m.GetObjectsCounter) > 0
   716  	}
   717  
   718  	return true
   719  }
   720  
   721  //ValidateCallCounters checks that all mocked methods of the interface have been called at least once
   722  //Deprecated: please use MinimockFinish method or use Finish method of minimock.Controller
   723  func (m *RecentIndexStorageMock) ValidateCallCounters() {
   724  
   725  	if !m.AddObjectFinished() {
   726  		m.t.Fatal("Expected call to RecentIndexStorageMock.AddObject")
   727  	}
   728  
   729  	if !m.AddObjectWithTLLFinished() {
   730  		m.t.Fatal("Expected call to RecentIndexStorageMock.AddObjectWithTLL")
   731  	}
   732  
   733  	if !m.DecreaseIndexTTLFinished() {
   734  		m.t.Fatal("Expected call to RecentIndexStorageMock.DecreaseIndexTTL")
   735  	}
   736  
   737  	if !m.FilterNotExistWithLockFinished() {
   738  		m.t.Fatal("Expected call to RecentIndexStorageMock.FilterNotExistWithLock")
   739  	}
   740  
   741  	if !m.GetObjectsFinished() {
   742  		m.t.Fatal("Expected call to RecentIndexStorageMock.GetObjects")
   743  	}
   744  
   745  }
   746  
   747  //CheckMocksCalled checks that all mocked methods of the interface have been called at least once
   748  //Deprecated: please use MinimockFinish method or use Finish method of minimock.Controller
   749  func (m *RecentIndexStorageMock) CheckMocksCalled() {
   750  	m.Finish()
   751  }
   752  
   753  //Finish checks that all mocked methods of the interface have been called at least once
   754  //Deprecated: please use MinimockFinish or use Finish method of minimock.Controller
   755  func (m *RecentIndexStorageMock) Finish() {
   756  	m.MinimockFinish()
   757  }
   758  
   759  //MinimockFinish checks that all mocked methods of the interface have been called at least once
   760  func (m *RecentIndexStorageMock) MinimockFinish() {
   761  
   762  	if !m.AddObjectFinished() {
   763  		m.t.Fatal("Expected call to RecentIndexStorageMock.AddObject")
   764  	}
   765  
   766  	if !m.AddObjectWithTLLFinished() {
   767  		m.t.Fatal("Expected call to RecentIndexStorageMock.AddObjectWithTLL")
   768  	}
   769  
   770  	if !m.DecreaseIndexTTLFinished() {
   771  		m.t.Fatal("Expected call to RecentIndexStorageMock.DecreaseIndexTTL")
   772  	}
   773  
   774  	if !m.FilterNotExistWithLockFinished() {
   775  		m.t.Fatal("Expected call to RecentIndexStorageMock.FilterNotExistWithLock")
   776  	}
   777  
   778  	if !m.GetObjectsFinished() {
   779  		m.t.Fatal("Expected call to RecentIndexStorageMock.GetObjects")
   780  	}
   781  
   782  }
   783  
   784  //Wait waits for all mocked methods to be called at least once
   785  //Deprecated: please use MinimockWait or use Wait method of minimock.Controller
   786  func (m *RecentIndexStorageMock) Wait(timeout time.Duration) {
   787  	m.MinimockWait(timeout)
   788  }
   789  
   790  //MinimockWait waits for all mocked methods to be called at least once
   791  //this method is called by minimock.Controller
   792  func (m *RecentIndexStorageMock) MinimockWait(timeout time.Duration) {
   793  	timeoutCh := time.After(timeout)
   794  	for {
   795  		ok := true
   796  		ok = ok && m.AddObjectFinished()
   797  		ok = ok && m.AddObjectWithTLLFinished()
   798  		ok = ok && m.DecreaseIndexTTLFinished()
   799  		ok = ok && m.FilterNotExistWithLockFinished()
   800  		ok = ok && m.GetObjectsFinished()
   801  
   802  		if ok {
   803  			return
   804  		}
   805  
   806  		select {
   807  		case <-timeoutCh:
   808  
   809  			if !m.AddObjectFinished() {
   810  				m.t.Error("Expected call to RecentIndexStorageMock.AddObject")
   811  			}
   812  
   813  			if !m.AddObjectWithTLLFinished() {
   814  				m.t.Error("Expected call to RecentIndexStorageMock.AddObjectWithTLL")
   815  			}
   816  
   817  			if !m.DecreaseIndexTTLFinished() {
   818  				m.t.Error("Expected call to RecentIndexStorageMock.DecreaseIndexTTL")
   819  			}
   820  
   821  			if !m.FilterNotExistWithLockFinished() {
   822  				m.t.Error("Expected call to RecentIndexStorageMock.FilterNotExistWithLock")
   823  			}
   824  
   825  			if !m.GetObjectsFinished() {
   826  				m.t.Error("Expected call to RecentIndexStorageMock.GetObjects")
   827  			}
   828  
   829  			m.t.Fatalf("Some mocks were not called on time: %s", timeout)
   830  			return
   831  		default:
   832  			time.Sleep(time.Millisecond)
   833  		}
   834  	}
   835  }
   836  
   837  //AllMocksCalled returns true if all mocked methods were called before the execution of AllMocksCalled,
   838  //it can be used with assert/require, i.e. assert.True(mock.AllMocksCalled())
   839  func (m *RecentIndexStorageMock) AllMocksCalled() bool {
   840  
   841  	if !m.AddObjectFinished() {
   842  		return false
   843  	}
   844  
   845  	if !m.AddObjectWithTLLFinished() {
   846  		return false
   847  	}
   848  
   849  	if !m.DecreaseIndexTTLFinished() {
   850  		return false
   851  	}
   852  
   853  	if !m.FilterNotExistWithLockFinished() {
   854  		return false
   855  	}
   856  
   857  	if !m.GetObjectsFinished() {
   858  		return false
   859  	}
   860  
   861  	return true
   862  }