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