github.com/braveheart12/just@v0.8.7/ledger/storage/db_context_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 "DBContext" can be found in github.com/insolar/insolar/ledger/storage
     7  */
     8  import (
     9  	context "context"
    10  	"sync/atomic"
    11  	"time"
    12  
    13  	badger "github.com/dgraph-io/badger"
    14  	"github.com/gojuno/minimock"
    15  	core "github.com/insolar/insolar/core"
    16  	record "github.com/insolar/insolar/ledger/storage/record"
    17  
    18  	testify_assert "github.com/stretchr/testify/assert"
    19  )
    20  
    21  //DBContextMock implements github.com/insolar/insolar/ledger/storage.DBContext
    22  type DBContextMock struct {
    23  	t minimock.Tester
    24  
    25  	BeginTransactionFunc       func(p bool) (r *TransactionManager, r1 error)
    26  	BeginTransactionCounter    uint64
    27  	BeginTransactionPreCounter uint64
    28  	BeginTransactionMock       mDBContextMockBeginTransaction
    29  
    30  	CloseFunc       func() (r error)
    31  	CloseCounter    uint64
    32  	ClosePreCounter uint64
    33  	CloseMock       mDBContextMockClose
    34  
    35  	GetBadgerDBFunc       func() (r *badger.DB)
    36  	GetBadgerDBCounter    uint64
    37  	GetBadgerDBPreCounter uint64
    38  	GetBadgerDBMock       mDBContextMockGetBadgerDB
    39  
    40  	IterateRecordsOnPulseFunc       func(p context.Context, p1 core.RecordID, p2 core.PulseNumber, p3 func(p core.RecordID, p1 record.Record) (r error)) (r error)
    41  	IterateRecordsOnPulseCounter    uint64
    42  	IterateRecordsOnPulsePreCounter uint64
    43  	IterateRecordsOnPulseMock       mDBContextMockIterateRecordsOnPulse
    44  
    45  	StoreKeyValuesFunc       func(p context.Context, p1 []core.KV) (r error)
    46  	StoreKeyValuesCounter    uint64
    47  	StoreKeyValuesPreCounter uint64
    48  	StoreKeyValuesMock       mDBContextMockStoreKeyValues
    49  
    50  	UpdateFunc       func(p context.Context, p1 func(p *TransactionManager) (r error)) (r error)
    51  	UpdateCounter    uint64
    52  	UpdatePreCounter uint64
    53  	UpdateMock       mDBContextMockUpdate
    54  
    55  	ViewFunc       func(p context.Context, p1 func(p *TransactionManager) (r error)) (r error)
    56  	ViewCounter    uint64
    57  	ViewPreCounter uint64
    58  	ViewMock       mDBContextMockView
    59  
    60  	getFunc       func(p context.Context, p1 []byte) (r []byte, r1 error)
    61  	getCounter    uint64
    62  	getPreCounter uint64
    63  	getMock       mDBContextMockget
    64  
    65  	iterateFunc       func(p context.Context, p1 []byte, p2 func(p []byte, p1 []byte) (r error)) (r error)
    66  	iterateCounter    uint64
    67  	iteratePreCounter uint64
    68  	iterateMock       mDBContextMockiterate
    69  
    70  	setFunc       func(p context.Context, p1 []byte, p2 []byte) (r error)
    71  	setCounter    uint64
    72  	setPreCounter uint64
    73  	setMock       mDBContextMockset
    74  
    75  	waitingFlightFunc       func()
    76  	waitingFlightCounter    uint64
    77  	waitingFlightPreCounter uint64
    78  	waitingFlightMock       mDBContextMockwaitingFlight
    79  }
    80  
    81  //NewDBContextMock returns a mock for github.com/insolar/insolar/ledger/storage.DBContext
    82  func NewDBContextMock(t minimock.Tester) *DBContextMock {
    83  	m := &DBContextMock{t: t}
    84  
    85  	if controller, ok := t.(minimock.MockController); ok {
    86  		controller.RegisterMocker(m)
    87  	}
    88  
    89  	m.BeginTransactionMock = mDBContextMockBeginTransaction{mock: m}
    90  	m.CloseMock = mDBContextMockClose{mock: m}
    91  	m.GetBadgerDBMock = mDBContextMockGetBadgerDB{mock: m}
    92  	m.IterateRecordsOnPulseMock = mDBContextMockIterateRecordsOnPulse{mock: m}
    93  	m.StoreKeyValuesMock = mDBContextMockStoreKeyValues{mock: m}
    94  	m.UpdateMock = mDBContextMockUpdate{mock: m}
    95  	m.ViewMock = mDBContextMockView{mock: m}
    96  	m.getMock = mDBContextMockget{mock: m}
    97  	m.iterateMock = mDBContextMockiterate{mock: m}
    98  	m.setMock = mDBContextMockset{mock: m}
    99  	m.waitingFlightMock = mDBContextMockwaitingFlight{mock: m}
   100  
   101  	return m
   102  }
   103  
   104  type mDBContextMockBeginTransaction struct {
   105  	mock              *DBContextMock
   106  	mainExpectation   *DBContextMockBeginTransactionExpectation
   107  	expectationSeries []*DBContextMockBeginTransactionExpectation
   108  }
   109  
   110  type DBContextMockBeginTransactionExpectation struct {
   111  	input  *DBContextMockBeginTransactionInput
   112  	result *DBContextMockBeginTransactionResult
   113  }
   114  
   115  type DBContextMockBeginTransactionInput struct {
   116  	p bool
   117  }
   118  
   119  type DBContextMockBeginTransactionResult struct {
   120  	r  *TransactionManager
   121  	r1 error
   122  }
   123  
   124  //Expect specifies that invocation of DBContext.BeginTransaction is expected from 1 to Infinity times
   125  func (m *mDBContextMockBeginTransaction) Expect(p bool) *mDBContextMockBeginTransaction {
   126  	m.mock.BeginTransactionFunc = nil
   127  	m.expectationSeries = nil
   128  
   129  	if m.mainExpectation == nil {
   130  		m.mainExpectation = &DBContextMockBeginTransactionExpectation{}
   131  	}
   132  	m.mainExpectation.input = &DBContextMockBeginTransactionInput{p}
   133  	return m
   134  }
   135  
   136  //Return specifies results of invocation of DBContext.BeginTransaction
   137  func (m *mDBContextMockBeginTransaction) Return(r *TransactionManager, r1 error) *DBContextMock {
   138  	m.mock.BeginTransactionFunc = nil
   139  	m.expectationSeries = nil
   140  
   141  	if m.mainExpectation == nil {
   142  		m.mainExpectation = &DBContextMockBeginTransactionExpectation{}
   143  	}
   144  	m.mainExpectation.result = &DBContextMockBeginTransactionResult{r, r1}
   145  	return m.mock
   146  }
   147  
   148  //ExpectOnce specifies that invocation of DBContext.BeginTransaction is expected once
   149  func (m *mDBContextMockBeginTransaction) ExpectOnce(p bool) *DBContextMockBeginTransactionExpectation {
   150  	m.mock.BeginTransactionFunc = nil
   151  	m.mainExpectation = nil
   152  
   153  	expectation := &DBContextMockBeginTransactionExpectation{}
   154  	expectation.input = &DBContextMockBeginTransactionInput{p}
   155  	m.expectationSeries = append(m.expectationSeries, expectation)
   156  	return expectation
   157  }
   158  
   159  func (e *DBContextMockBeginTransactionExpectation) Return(r *TransactionManager, r1 error) {
   160  	e.result = &DBContextMockBeginTransactionResult{r, r1}
   161  }
   162  
   163  //Set uses given function f as a mock of DBContext.BeginTransaction method
   164  func (m *mDBContextMockBeginTransaction) Set(f func(p bool) (r *TransactionManager, r1 error)) *DBContextMock {
   165  	m.mainExpectation = nil
   166  	m.expectationSeries = nil
   167  
   168  	m.mock.BeginTransactionFunc = f
   169  	return m.mock
   170  }
   171  
   172  //BeginTransaction implements github.com/insolar/insolar/ledger/storage.DBContext interface
   173  func (m *DBContextMock) BeginTransaction(p bool) (r *TransactionManager, r1 error) {
   174  	counter := atomic.AddUint64(&m.BeginTransactionPreCounter, 1)
   175  	defer atomic.AddUint64(&m.BeginTransactionCounter, 1)
   176  
   177  	if len(m.BeginTransactionMock.expectationSeries) > 0 {
   178  		if counter > uint64(len(m.BeginTransactionMock.expectationSeries)) {
   179  			m.t.Fatalf("Unexpected call to DBContextMock.BeginTransaction. %v", p)
   180  			return
   181  		}
   182  
   183  		input := m.BeginTransactionMock.expectationSeries[counter-1].input
   184  		testify_assert.Equal(m.t, *input, DBContextMockBeginTransactionInput{p}, "DBContext.BeginTransaction got unexpected parameters")
   185  
   186  		result := m.BeginTransactionMock.expectationSeries[counter-1].result
   187  		if result == nil {
   188  			m.t.Fatal("No results are set for the DBContextMock.BeginTransaction")
   189  			return
   190  		}
   191  
   192  		r = result.r
   193  		r1 = result.r1
   194  
   195  		return
   196  	}
   197  
   198  	if m.BeginTransactionMock.mainExpectation != nil {
   199  
   200  		input := m.BeginTransactionMock.mainExpectation.input
   201  		if input != nil {
   202  			testify_assert.Equal(m.t, *input, DBContextMockBeginTransactionInput{p}, "DBContext.BeginTransaction got unexpected parameters")
   203  		}
   204  
   205  		result := m.BeginTransactionMock.mainExpectation.result
   206  		if result == nil {
   207  			m.t.Fatal("No results are set for the DBContextMock.BeginTransaction")
   208  		}
   209  
   210  		r = result.r
   211  		r1 = result.r1
   212  
   213  		return
   214  	}
   215  
   216  	if m.BeginTransactionFunc == nil {
   217  		m.t.Fatalf("Unexpected call to DBContextMock.BeginTransaction. %v", p)
   218  		return
   219  	}
   220  
   221  	return m.BeginTransactionFunc(p)
   222  }
   223  
   224  //BeginTransactionMinimockCounter returns a count of DBContextMock.BeginTransactionFunc invocations
   225  func (m *DBContextMock) BeginTransactionMinimockCounter() uint64 {
   226  	return atomic.LoadUint64(&m.BeginTransactionCounter)
   227  }
   228  
   229  //BeginTransactionMinimockPreCounter returns the value of DBContextMock.BeginTransaction invocations
   230  func (m *DBContextMock) BeginTransactionMinimockPreCounter() uint64 {
   231  	return atomic.LoadUint64(&m.BeginTransactionPreCounter)
   232  }
   233  
   234  //BeginTransactionFinished returns true if mock invocations count is ok
   235  func (m *DBContextMock) BeginTransactionFinished() bool {
   236  	// if expectation series were set then invocations count should be equal to expectations count
   237  	if len(m.BeginTransactionMock.expectationSeries) > 0 {
   238  		return atomic.LoadUint64(&m.BeginTransactionCounter) == uint64(len(m.BeginTransactionMock.expectationSeries))
   239  	}
   240  
   241  	// if main expectation was set then invocations count should be greater than zero
   242  	if m.BeginTransactionMock.mainExpectation != nil {
   243  		return atomic.LoadUint64(&m.BeginTransactionCounter) > 0
   244  	}
   245  
   246  	// if func was set then invocations count should be greater than zero
   247  	if m.BeginTransactionFunc != nil {
   248  		return atomic.LoadUint64(&m.BeginTransactionCounter) > 0
   249  	}
   250  
   251  	return true
   252  }
   253  
   254  type mDBContextMockClose struct {
   255  	mock              *DBContextMock
   256  	mainExpectation   *DBContextMockCloseExpectation
   257  	expectationSeries []*DBContextMockCloseExpectation
   258  }
   259  
   260  type DBContextMockCloseExpectation struct {
   261  	result *DBContextMockCloseResult
   262  }
   263  
   264  type DBContextMockCloseResult struct {
   265  	r error
   266  }
   267  
   268  //Expect specifies that invocation of DBContext.Close is expected from 1 to Infinity times
   269  func (m *mDBContextMockClose) Expect() *mDBContextMockClose {
   270  	m.mock.CloseFunc = nil
   271  	m.expectationSeries = nil
   272  
   273  	if m.mainExpectation == nil {
   274  		m.mainExpectation = &DBContextMockCloseExpectation{}
   275  	}
   276  
   277  	return m
   278  }
   279  
   280  //Return specifies results of invocation of DBContext.Close
   281  func (m *mDBContextMockClose) Return(r error) *DBContextMock {
   282  	m.mock.CloseFunc = nil
   283  	m.expectationSeries = nil
   284  
   285  	if m.mainExpectation == nil {
   286  		m.mainExpectation = &DBContextMockCloseExpectation{}
   287  	}
   288  	m.mainExpectation.result = &DBContextMockCloseResult{r}
   289  	return m.mock
   290  }
   291  
   292  //ExpectOnce specifies that invocation of DBContext.Close is expected once
   293  func (m *mDBContextMockClose) ExpectOnce() *DBContextMockCloseExpectation {
   294  	m.mock.CloseFunc = nil
   295  	m.mainExpectation = nil
   296  
   297  	expectation := &DBContextMockCloseExpectation{}
   298  
   299  	m.expectationSeries = append(m.expectationSeries, expectation)
   300  	return expectation
   301  }
   302  
   303  func (e *DBContextMockCloseExpectation) Return(r error) {
   304  	e.result = &DBContextMockCloseResult{r}
   305  }
   306  
   307  //Set uses given function f as a mock of DBContext.Close method
   308  func (m *mDBContextMockClose) Set(f func() (r error)) *DBContextMock {
   309  	m.mainExpectation = nil
   310  	m.expectationSeries = nil
   311  
   312  	m.mock.CloseFunc = f
   313  	return m.mock
   314  }
   315  
   316  //Close implements github.com/insolar/insolar/ledger/storage.DBContext interface
   317  func (m *DBContextMock) Close() (r error) {
   318  	counter := atomic.AddUint64(&m.ClosePreCounter, 1)
   319  	defer atomic.AddUint64(&m.CloseCounter, 1)
   320  
   321  	if len(m.CloseMock.expectationSeries) > 0 {
   322  		if counter > uint64(len(m.CloseMock.expectationSeries)) {
   323  			m.t.Fatalf("Unexpected call to DBContextMock.Close.")
   324  			return
   325  		}
   326  
   327  		result := m.CloseMock.expectationSeries[counter-1].result
   328  		if result == nil {
   329  			m.t.Fatal("No results are set for the DBContextMock.Close")
   330  			return
   331  		}
   332  
   333  		r = result.r
   334  
   335  		return
   336  	}
   337  
   338  	if m.CloseMock.mainExpectation != nil {
   339  
   340  		result := m.CloseMock.mainExpectation.result
   341  		if result == nil {
   342  			m.t.Fatal("No results are set for the DBContextMock.Close")
   343  		}
   344  
   345  		r = result.r
   346  
   347  		return
   348  	}
   349  
   350  	if m.CloseFunc == nil {
   351  		m.t.Fatalf("Unexpected call to DBContextMock.Close.")
   352  		return
   353  	}
   354  
   355  	return m.CloseFunc()
   356  }
   357  
   358  //CloseMinimockCounter returns a count of DBContextMock.CloseFunc invocations
   359  func (m *DBContextMock) CloseMinimockCounter() uint64 {
   360  	return atomic.LoadUint64(&m.CloseCounter)
   361  }
   362  
   363  //CloseMinimockPreCounter returns the value of DBContextMock.Close invocations
   364  func (m *DBContextMock) CloseMinimockPreCounter() uint64 {
   365  	return atomic.LoadUint64(&m.ClosePreCounter)
   366  }
   367  
   368  //CloseFinished returns true if mock invocations count is ok
   369  func (m *DBContextMock) CloseFinished() bool {
   370  	// if expectation series were set then invocations count should be equal to expectations count
   371  	if len(m.CloseMock.expectationSeries) > 0 {
   372  		return atomic.LoadUint64(&m.CloseCounter) == uint64(len(m.CloseMock.expectationSeries))
   373  	}
   374  
   375  	// if main expectation was set then invocations count should be greater than zero
   376  	if m.CloseMock.mainExpectation != nil {
   377  		return atomic.LoadUint64(&m.CloseCounter) > 0
   378  	}
   379  
   380  	// if func was set then invocations count should be greater than zero
   381  	if m.CloseFunc != nil {
   382  		return atomic.LoadUint64(&m.CloseCounter) > 0
   383  	}
   384  
   385  	return true
   386  }
   387  
   388  type mDBContextMockGetBadgerDB struct {
   389  	mock              *DBContextMock
   390  	mainExpectation   *DBContextMockGetBadgerDBExpectation
   391  	expectationSeries []*DBContextMockGetBadgerDBExpectation
   392  }
   393  
   394  type DBContextMockGetBadgerDBExpectation struct {
   395  	result *DBContextMockGetBadgerDBResult
   396  }
   397  
   398  type DBContextMockGetBadgerDBResult struct {
   399  	r *badger.DB
   400  }
   401  
   402  //Expect specifies that invocation of DBContext.GetBadgerDB is expected from 1 to Infinity times
   403  func (m *mDBContextMockGetBadgerDB) Expect() *mDBContextMockGetBadgerDB {
   404  	m.mock.GetBadgerDBFunc = nil
   405  	m.expectationSeries = nil
   406  
   407  	if m.mainExpectation == nil {
   408  		m.mainExpectation = &DBContextMockGetBadgerDBExpectation{}
   409  	}
   410  
   411  	return m
   412  }
   413  
   414  //Return specifies results of invocation of DBContext.GetBadgerDB
   415  func (m *mDBContextMockGetBadgerDB) Return(r *badger.DB) *DBContextMock {
   416  	m.mock.GetBadgerDBFunc = nil
   417  	m.expectationSeries = nil
   418  
   419  	if m.mainExpectation == nil {
   420  		m.mainExpectation = &DBContextMockGetBadgerDBExpectation{}
   421  	}
   422  	m.mainExpectation.result = &DBContextMockGetBadgerDBResult{r}
   423  	return m.mock
   424  }
   425  
   426  //ExpectOnce specifies that invocation of DBContext.GetBadgerDB is expected once
   427  func (m *mDBContextMockGetBadgerDB) ExpectOnce() *DBContextMockGetBadgerDBExpectation {
   428  	m.mock.GetBadgerDBFunc = nil
   429  	m.mainExpectation = nil
   430  
   431  	expectation := &DBContextMockGetBadgerDBExpectation{}
   432  
   433  	m.expectationSeries = append(m.expectationSeries, expectation)
   434  	return expectation
   435  }
   436  
   437  func (e *DBContextMockGetBadgerDBExpectation) Return(r *badger.DB) {
   438  	e.result = &DBContextMockGetBadgerDBResult{r}
   439  }
   440  
   441  //Set uses given function f as a mock of DBContext.GetBadgerDB method
   442  func (m *mDBContextMockGetBadgerDB) Set(f func() (r *badger.DB)) *DBContextMock {
   443  	m.mainExpectation = nil
   444  	m.expectationSeries = nil
   445  
   446  	m.mock.GetBadgerDBFunc = f
   447  	return m.mock
   448  }
   449  
   450  //GetBadgerDB implements github.com/insolar/insolar/ledger/storage.DBContext interface
   451  func (m *DBContextMock) GetBadgerDB() (r *badger.DB) {
   452  	counter := atomic.AddUint64(&m.GetBadgerDBPreCounter, 1)
   453  	defer atomic.AddUint64(&m.GetBadgerDBCounter, 1)
   454  
   455  	if len(m.GetBadgerDBMock.expectationSeries) > 0 {
   456  		if counter > uint64(len(m.GetBadgerDBMock.expectationSeries)) {
   457  			m.t.Fatalf("Unexpected call to DBContextMock.GetBadgerDB.")
   458  			return
   459  		}
   460  
   461  		result := m.GetBadgerDBMock.expectationSeries[counter-1].result
   462  		if result == nil {
   463  			m.t.Fatal("No results are set for the DBContextMock.GetBadgerDB")
   464  			return
   465  		}
   466  
   467  		r = result.r
   468  
   469  		return
   470  	}
   471  
   472  	if m.GetBadgerDBMock.mainExpectation != nil {
   473  
   474  		result := m.GetBadgerDBMock.mainExpectation.result
   475  		if result == nil {
   476  			m.t.Fatal("No results are set for the DBContextMock.GetBadgerDB")
   477  		}
   478  
   479  		r = result.r
   480  
   481  		return
   482  	}
   483  
   484  	if m.GetBadgerDBFunc == nil {
   485  		m.t.Fatalf("Unexpected call to DBContextMock.GetBadgerDB.")
   486  		return
   487  	}
   488  
   489  	return m.GetBadgerDBFunc()
   490  }
   491  
   492  //GetBadgerDBMinimockCounter returns a count of DBContextMock.GetBadgerDBFunc invocations
   493  func (m *DBContextMock) GetBadgerDBMinimockCounter() uint64 {
   494  	return atomic.LoadUint64(&m.GetBadgerDBCounter)
   495  }
   496  
   497  //GetBadgerDBMinimockPreCounter returns the value of DBContextMock.GetBadgerDB invocations
   498  func (m *DBContextMock) GetBadgerDBMinimockPreCounter() uint64 {
   499  	return atomic.LoadUint64(&m.GetBadgerDBPreCounter)
   500  }
   501  
   502  //GetBadgerDBFinished returns true if mock invocations count is ok
   503  func (m *DBContextMock) GetBadgerDBFinished() bool {
   504  	// if expectation series were set then invocations count should be equal to expectations count
   505  	if len(m.GetBadgerDBMock.expectationSeries) > 0 {
   506  		return atomic.LoadUint64(&m.GetBadgerDBCounter) == uint64(len(m.GetBadgerDBMock.expectationSeries))
   507  	}
   508  
   509  	// if main expectation was set then invocations count should be greater than zero
   510  	if m.GetBadgerDBMock.mainExpectation != nil {
   511  		return atomic.LoadUint64(&m.GetBadgerDBCounter) > 0
   512  	}
   513  
   514  	// if func was set then invocations count should be greater than zero
   515  	if m.GetBadgerDBFunc != nil {
   516  		return atomic.LoadUint64(&m.GetBadgerDBCounter) > 0
   517  	}
   518  
   519  	return true
   520  }
   521  
   522  type mDBContextMockIterateRecordsOnPulse struct {
   523  	mock              *DBContextMock
   524  	mainExpectation   *DBContextMockIterateRecordsOnPulseExpectation
   525  	expectationSeries []*DBContextMockIterateRecordsOnPulseExpectation
   526  }
   527  
   528  type DBContextMockIterateRecordsOnPulseExpectation struct {
   529  	input  *DBContextMockIterateRecordsOnPulseInput
   530  	result *DBContextMockIterateRecordsOnPulseResult
   531  }
   532  
   533  type DBContextMockIterateRecordsOnPulseInput struct {
   534  	p  context.Context
   535  	p1 core.RecordID
   536  	p2 core.PulseNumber
   537  	p3 func(p core.RecordID, p1 record.Record) (r error)
   538  }
   539  
   540  type DBContextMockIterateRecordsOnPulseResult struct {
   541  	r error
   542  }
   543  
   544  //Expect specifies that invocation of DBContext.IterateRecordsOnPulse is expected from 1 to Infinity times
   545  func (m *mDBContextMockIterateRecordsOnPulse) Expect(p context.Context, p1 core.RecordID, p2 core.PulseNumber, p3 func(p core.RecordID, p1 record.Record) (r error)) *mDBContextMockIterateRecordsOnPulse {
   546  	m.mock.IterateRecordsOnPulseFunc = nil
   547  	m.expectationSeries = nil
   548  
   549  	if m.mainExpectation == nil {
   550  		m.mainExpectation = &DBContextMockIterateRecordsOnPulseExpectation{}
   551  	}
   552  	m.mainExpectation.input = &DBContextMockIterateRecordsOnPulseInput{p, p1, p2, p3}
   553  	return m
   554  }
   555  
   556  //Return specifies results of invocation of DBContext.IterateRecordsOnPulse
   557  func (m *mDBContextMockIterateRecordsOnPulse) Return(r error) *DBContextMock {
   558  	m.mock.IterateRecordsOnPulseFunc = nil
   559  	m.expectationSeries = nil
   560  
   561  	if m.mainExpectation == nil {
   562  		m.mainExpectation = &DBContextMockIterateRecordsOnPulseExpectation{}
   563  	}
   564  	m.mainExpectation.result = &DBContextMockIterateRecordsOnPulseResult{r}
   565  	return m.mock
   566  }
   567  
   568  //ExpectOnce specifies that invocation of DBContext.IterateRecordsOnPulse is expected once
   569  func (m *mDBContextMockIterateRecordsOnPulse) ExpectOnce(p context.Context, p1 core.RecordID, p2 core.PulseNumber, p3 func(p core.RecordID, p1 record.Record) (r error)) *DBContextMockIterateRecordsOnPulseExpectation {
   570  	m.mock.IterateRecordsOnPulseFunc = nil
   571  	m.mainExpectation = nil
   572  
   573  	expectation := &DBContextMockIterateRecordsOnPulseExpectation{}
   574  	expectation.input = &DBContextMockIterateRecordsOnPulseInput{p, p1, p2, p3}
   575  	m.expectationSeries = append(m.expectationSeries, expectation)
   576  	return expectation
   577  }
   578  
   579  func (e *DBContextMockIterateRecordsOnPulseExpectation) Return(r error) {
   580  	e.result = &DBContextMockIterateRecordsOnPulseResult{r}
   581  }
   582  
   583  //Set uses given function f as a mock of DBContext.IterateRecordsOnPulse method
   584  func (m *mDBContextMockIterateRecordsOnPulse) Set(f func(p context.Context, p1 core.RecordID, p2 core.PulseNumber, p3 func(p core.RecordID, p1 record.Record) (r error)) (r error)) *DBContextMock {
   585  	m.mainExpectation = nil
   586  	m.expectationSeries = nil
   587  
   588  	m.mock.IterateRecordsOnPulseFunc = f
   589  	return m.mock
   590  }
   591  
   592  //IterateRecordsOnPulse implements github.com/insolar/insolar/ledger/storage.DBContext interface
   593  func (m *DBContextMock) IterateRecordsOnPulse(p context.Context, p1 core.RecordID, p2 core.PulseNumber, p3 func(p core.RecordID, p1 record.Record) (r error)) (r error) {
   594  	counter := atomic.AddUint64(&m.IterateRecordsOnPulsePreCounter, 1)
   595  	defer atomic.AddUint64(&m.IterateRecordsOnPulseCounter, 1)
   596  
   597  	if len(m.IterateRecordsOnPulseMock.expectationSeries) > 0 {
   598  		if counter > uint64(len(m.IterateRecordsOnPulseMock.expectationSeries)) {
   599  			m.t.Fatalf("Unexpected call to DBContextMock.IterateRecordsOnPulse. %v %v %v %v", p, p1, p2, p3)
   600  			return
   601  		}
   602  
   603  		input := m.IterateRecordsOnPulseMock.expectationSeries[counter-1].input
   604  		testify_assert.Equal(m.t, *input, DBContextMockIterateRecordsOnPulseInput{p, p1, p2, p3}, "DBContext.IterateRecordsOnPulse got unexpected parameters")
   605  
   606  		result := m.IterateRecordsOnPulseMock.expectationSeries[counter-1].result
   607  		if result == nil {
   608  			m.t.Fatal("No results are set for the DBContextMock.IterateRecordsOnPulse")
   609  			return
   610  		}
   611  
   612  		r = result.r
   613  
   614  		return
   615  	}
   616  
   617  	if m.IterateRecordsOnPulseMock.mainExpectation != nil {
   618  
   619  		input := m.IterateRecordsOnPulseMock.mainExpectation.input
   620  		if input != nil {
   621  			testify_assert.Equal(m.t, *input, DBContextMockIterateRecordsOnPulseInput{p, p1, p2, p3}, "DBContext.IterateRecordsOnPulse got unexpected parameters")
   622  		}
   623  
   624  		result := m.IterateRecordsOnPulseMock.mainExpectation.result
   625  		if result == nil {
   626  			m.t.Fatal("No results are set for the DBContextMock.IterateRecordsOnPulse")
   627  		}
   628  
   629  		r = result.r
   630  
   631  		return
   632  	}
   633  
   634  	if m.IterateRecordsOnPulseFunc == nil {
   635  		m.t.Fatalf("Unexpected call to DBContextMock.IterateRecordsOnPulse. %v %v %v %v", p, p1, p2, p3)
   636  		return
   637  	}
   638  
   639  	return m.IterateRecordsOnPulseFunc(p, p1, p2, p3)
   640  }
   641  
   642  //IterateRecordsOnPulseMinimockCounter returns a count of DBContextMock.IterateRecordsOnPulseFunc invocations
   643  func (m *DBContextMock) IterateRecordsOnPulseMinimockCounter() uint64 {
   644  	return atomic.LoadUint64(&m.IterateRecordsOnPulseCounter)
   645  }
   646  
   647  //IterateRecordsOnPulseMinimockPreCounter returns the value of DBContextMock.IterateRecordsOnPulse invocations
   648  func (m *DBContextMock) IterateRecordsOnPulseMinimockPreCounter() uint64 {
   649  	return atomic.LoadUint64(&m.IterateRecordsOnPulsePreCounter)
   650  }
   651  
   652  //IterateRecordsOnPulseFinished returns true if mock invocations count is ok
   653  func (m *DBContextMock) IterateRecordsOnPulseFinished() bool {
   654  	// if expectation series were set then invocations count should be equal to expectations count
   655  	if len(m.IterateRecordsOnPulseMock.expectationSeries) > 0 {
   656  		return atomic.LoadUint64(&m.IterateRecordsOnPulseCounter) == uint64(len(m.IterateRecordsOnPulseMock.expectationSeries))
   657  	}
   658  
   659  	// if main expectation was set then invocations count should be greater than zero
   660  	if m.IterateRecordsOnPulseMock.mainExpectation != nil {
   661  		return atomic.LoadUint64(&m.IterateRecordsOnPulseCounter) > 0
   662  	}
   663  
   664  	// if func was set then invocations count should be greater than zero
   665  	if m.IterateRecordsOnPulseFunc != nil {
   666  		return atomic.LoadUint64(&m.IterateRecordsOnPulseCounter) > 0
   667  	}
   668  
   669  	return true
   670  }
   671  
   672  type mDBContextMockStoreKeyValues struct {
   673  	mock              *DBContextMock
   674  	mainExpectation   *DBContextMockStoreKeyValuesExpectation
   675  	expectationSeries []*DBContextMockStoreKeyValuesExpectation
   676  }
   677  
   678  type DBContextMockStoreKeyValuesExpectation struct {
   679  	input  *DBContextMockStoreKeyValuesInput
   680  	result *DBContextMockStoreKeyValuesResult
   681  }
   682  
   683  type DBContextMockStoreKeyValuesInput struct {
   684  	p  context.Context
   685  	p1 []core.KV
   686  }
   687  
   688  type DBContextMockStoreKeyValuesResult struct {
   689  	r error
   690  }
   691  
   692  //Expect specifies that invocation of DBContext.StoreKeyValues is expected from 1 to Infinity times
   693  func (m *mDBContextMockStoreKeyValues) Expect(p context.Context, p1 []core.KV) *mDBContextMockStoreKeyValues {
   694  	m.mock.StoreKeyValuesFunc = nil
   695  	m.expectationSeries = nil
   696  
   697  	if m.mainExpectation == nil {
   698  		m.mainExpectation = &DBContextMockStoreKeyValuesExpectation{}
   699  	}
   700  	m.mainExpectation.input = &DBContextMockStoreKeyValuesInput{p, p1}
   701  	return m
   702  }
   703  
   704  //Return specifies results of invocation of DBContext.StoreKeyValues
   705  func (m *mDBContextMockStoreKeyValues) Return(r error) *DBContextMock {
   706  	m.mock.StoreKeyValuesFunc = nil
   707  	m.expectationSeries = nil
   708  
   709  	if m.mainExpectation == nil {
   710  		m.mainExpectation = &DBContextMockStoreKeyValuesExpectation{}
   711  	}
   712  	m.mainExpectation.result = &DBContextMockStoreKeyValuesResult{r}
   713  	return m.mock
   714  }
   715  
   716  //ExpectOnce specifies that invocation of DBContext.StoreKeyValues is expected once
   717  func (m *mDBContextMockStoreKeyValues) ExpectOnce(p context.Context, p1 []core.KV) *DBContextMockStoreKeyValuesExpectation {
   718  	m.mock.StoreKeyValuesFunc = nil
   719  	m.mainExpectation = nil
   720  
   721  	expectation := &DBContextMockStoreKeyValuesExpectation{}
   722  	expectation.input = &DBContextMockStoreKeyValuesInput{p, p1}
   723  	m.expectationSeries = append(m.expectationSeries, expectation)
   724  	return expectation
   725  }
   726  
   727  func (e *DBContextMockStoreKeyValuesExpectation) Return(r error) {
   728  	e.result = &DBContextMockStoreKeyValuesResult{r}
   729  }
   730  
   731  //Set uses given function f as a mock of DBContext.StoreKeyValues method
   732  func (m *mDBContextMockStoreKeyValues) Set(f func(p context.Context, p1 []core.KV) (r error)) *DBContextMock {
   733  	m.mainExpectation = nil
   734  	m.expectationSeries = nil
   735  
   736  	m.mock.StoreKeyValuesFunc = f
   737  	return m.mock
   738  }
   739  
   740  //StoreKeyValues implements github.com/insolar/insolar/ledger/storage.DBContext interface
   741  func (m *DBContextMock) StoreKeyValues(p context.Context, p1 []core.KV) (r error) {
   742  	counter := atomic.AddUint64(&m.StoreKeyValuesPreCounter, 1)
   743  	defer atomic.AddUint64(&m.StoreKeyValuesCounter, 1)
   744  
   745  	if len(m.StoreKeyValuesMock.expectationSeries) > 0 {
   746  		if counter > uint64(len(m.StoreKeyValuesMock.expectationSeries)) {
   747  			m.t.Fatalf("Unexpected call to DBContextMock.StoreKeyValues. %v %v", p, p1)
   748  			return
   749  		}
   750  
   751  		input := m.StoreKeyValuesMock.expectationSeries[counter-1].input
   752  		testify_assert.Equal(m.t, *input, DBContextMockStoreKeyValuesInput{p, p1}, "DBContext.StoreKeyValues got unexpected parameters")
   753  
   754  		result := m.StoreKeyValuesMock.expectationSeries[counter-1].result
   755  		if result == nil {
   756  			m.t.Fatal("No results are set for the DBContextMock.StoreKeyValues")
   757  			return
   758  		}
   759  
   760  		r = result.r
   761  
   762  		return
   763  	}
   764  
   765  	if m.StoreKeyValuesMock.mainExpectation != nil {
   766  
   767  		input := m.StoreKeyValuesMock.mainExpectation.input
   768  		if input != nil {
   769  			testify_assert.Equal(m.t, *input, DBContextMockStoreKeyValuesInput{p, p1}, "DBContext.StoreKeyValues got unexpected parameters")
   770  		}
   771  
   772  		result := m.StoreKeyValuesMock.mainExpectation.result
   773  		if result == nil {
   774  			m.t.Fatal("No results are set for the DBContextMock.StoreKeyValues")
   775  		}
   776  
   777  		r = result.r
   778  
   779  		return
   780  	}
   781  
   782  	if m.StoreKeyValuesFunc == nil {
   783  		m.t.Fatalf("Unexpected call to DBContextMock.StoreKeyValues. %v %v", p, p1)
   784  		return
   785  	}
   786  
   787  	return m.StoreKeyValuesFunc(p, p1)
   788  }
   789  
   790  //StoreKeyValuesMinimockCounter returns a count of DBContextMock.StoreKeyValuesFunc invocations
   791  func (m *DBContextMock) StoreKeyValuesMinimockCounter() uint64 {
   792  	return atomic.LoadUint64(&m.StoreKeyValuesCounter)
   793  }
   794  
   795  //StoreKeyValuesMinimockPreCounter returns the value of DBContextMock.StoreKeyValues invocations
   796  func (m *DBContextMock) StoreKeyValuesMinimockPreCounter() uint64 {
   797  	return atomic.LoadUint64(&m.StoreKeyValuesPreCounter)
   798  }
   799  
   800  //StoreKeyValuesFinished returns true if mock invocations count is ok
   801  func (m *DBContextMock) StoreKeyValuesFinished() bool {
   802  	// if expectation series were set then invocations count should be equal to expectations count
   803  	if len(m.StoreKeyValuesMock.expectationSeries) > 0 {
   804  		return atomic.LoadUint64(&m.StoreKeyValuesCounter) == uint64(len(m.StoreKeyValuesMock.expectationSeries))
   805  	}
   806  
   807  	// if main expectation was set then invocations count should be greater than zero
   808  	if m.StoreKeyValuesMock.mainExpectation != nil {
   809  		return atomic.LoadUint64(&m.StoreKeyValuesCounter) > 0
   810  	}
   811  
   812  	// if func was set then invocations count should be greater than zero
   813  	if m.StoreKeyValuesFunc != nil {
   814  		return atomic.LoadUint64(&m.StoreKeyValuesCounter) > 0
   815  	}
   816  
   817  	return true
   818  }
   819  
   820  type mDBContextMockUpdate struct {
   821  	mock              *DBContextMock
   822  	mainExpectation   *DBContextMockUpdateExpectation
   823  	expectationSeries []*DBContextMockUpdateExpectation
   824  }
   825  
   826  type DBContextMockUpdateExpectation struct {
   827  	input  *DBContextMockUpdateInput
   828  	result *DBContextMockUpdateResult
   829  }
   830  
   831  type DBContextMockUpdateInput struct {
   832  	p  context.Context
   833  	p1 func(p *TransactionManager) (r error)
   834  }
   835  
   836  type DBContextMockUpdateResult struct {
   837  	r error
   838  }
   839  
   840  //Expect specifies that invocation of DBContext.Update is expected from 1 to Infinity times
   841  func (m *mDBContextMockUpdate) Expect(p context.Context, p1 func(p *TransactionManager) (r error)) *mDBContextMockUpdate {
   842  	m.mock.UpdateFunc = nil
   843  	m.expectationSeries = nil
   844  
   845  	if m.mainExpectation == nil {
   846  		m.mainExpectation = &DBContextMockUpdateExpectation{}
   847  	}
   848  	m.mainExpectation.input = &DBContextMockUpdateInput{p, p1}
   849  	return m
   850  }
   851  
   852  //Return specifies results of invocation of DBContext.Update
   853  func (m *mDBContextMockUpdate) Return(r error) *DBContextMock {
   854  	m.mock.UpdateFunc = nil
   855  	m.expectationSeries = nil
   856  
   857  	if m.mainExpectation == nil {
   858  		m.mainExpectation = &DBContextMockUpdateExpectation{}
   859  	}
   860  	m.mainExpectation.result = &DBContextMockUpdateResult{r}
   861  	return m.mock
   862  }
   863  
   864  //ExpectOnce specifies that invocation of DBContext.Update is expected once
   865  func (m *mDBContextMockUpdate) ExpectOnce(p context.Context, p1 func(p *TransactionManager) (r error)) *DBContextMockUpdateExpectation {
   866  	m.mock.UpdateFunc = nil
   867  	m.mainExpectation = nil
   868  
   869  	expectation := &DBContextMockUpdateExpectation{}
   870  	expectation.input = &DBContextMockUpdateInput{p, p1}
   871  	m.expectationSeries = append(m.expectationSeries, expectation)
   872  	return expectation
   873  }
   874  
   875  func (e *DBContextMockUpdateExpectation) Return(r error) {
   876  	e.result = &DBContextMockUpdateResult{r}
   877  }
   878  
   879  //Set uses given function f as a mock of DBContext.Update method
   880  func (m *mDBContextMockUpdate) Set(f func(p context.Context, p1 func(p *TransactionManager) (r error)) (r error)) *DBContextMock {
   881  	m.mainExpectation = nil
   882  	m.expectationSeries = nil
   883  
   884  	m.mock.UpdateFunc = f
   885  	return m.mock
   886  }
   887  
   888  //Update implements github.com/insolar/insolar/ledger/storage.DBContext interface
   889  func (m *DBContextMock) Update(p context.Context, p1 func(p *TransactionManager) (r error)) (r error) {
   890  	counter := atomic.AddUint64(&m.UpdatePreCounter, 1)
   891  	defer atomic.AddUint64(&m.UpdateCounter, 1)
   892  
   893  	if len(m.UpdateMock.expectationSeries) > 0 {
   894  		if counter > uint64(len(m.UpdateMock.expectationSeries)) {
   895  			m.t.Fatalf("Unexpected call to DBContextMock.Update. %v %v", p, p1)
   896  			return
   897  		}
   898  
   899  		input := m.UpdateMock.expectationSeries[counter-1].input
   900  		testify_assert.Equal(m.t, *input, DBContextMockUpdateInput{p, p1}, "DBContext.Update got unexpected parameters")
   901  
   902  		result := m.UpdateMock.expectationSeries[counter-1].result
   903  		if result == nil {
   904  			m.t.Fatal("No results are set for the DBContextMock.Update")
   905  			return
   906  		}
   907  
   908  		r = result.r
   909  
   910  		return
   911  	}
   912  
   913  	if m.UpdateMock.mainExpectation != nil {
   914  
   915  		input := m.UpdateMock.mainExpectation.input
   916  		if input != nil {
   917  			testify_assert.Equal(m.t, *input, DBContextMockUpdateInput{p, p1}, "DBContext.Update got unexpected parameters")
   918  		}
   919  
   920  		result := m.UpdateMock.mainExpectation.result
   921  		if result == nil {
   922  			m.t.Fatal("No results are set for the DBContextMock.Update")
   923  		}
   924  
   925  		r = result.r
   926  
   927  		return
   928  	}
   929  
   930  	if m.UpdateFunc == nil {
   931  		m.t.Fatalf("Unexpected call to DBContextMock.Update. %v %v", p, p1)
   932  		return
   933  	}
   934  
   935  	return m.UpdateFunc(p, p1)
   936  }
   937  
   938  //UpdateMinimockCounter returns a count of DBContextMock.UpdateFunc invocations
   939  func (m *DBContextMock) UpdateMinimockCounter() uint64 {
   940  	return atomic.LoadUint64(&m.UpdateCounter)
   941  }
   942  
   943  //UpdateMinimockPreCounter returns the value of DBContextMock.Update invocations
   944  func (m *DBContextMock) UpdateMinimockPreCounter() uint64 {
   945  	return atomic.LoadUint64(&m.UpdatePreCounter)
   946  }
   947  
   948  //UpdateFinished returns true if mock invocations count is ok
   949  func (m *DBContextMock) UpdateFinished() bool {
   950  	// if expectation series were set then invocations count should be equal to expectations count
   951  	if len(m.UpdateMock.expectationSeries) > 0 {
   952  		return atomic.LoadUint64(&m.UpdateCounter) == uint64(len(m.UpdateMock.expectationSeries))
   953  	}
   954  
   955  	// if main expectation was set then invocations count should be greater than zero
   956  	if m.UpdateMock.mainExpectation != nil {
   957  		return atomic.LoadUint64(&m.UpdateCounter) > 0
   958  	}
   959  
   960  	// if func was set then invocations count should be greater than zero
   961  	if m.UpdateFunc != nil {
   962  		return atomic.LoadUint64(&m.UpdateCounter) > 0
   963  	}
   964  
   965  	return true
   966  }
   967  
   968  type mDBContextMockView struct {
   969  	mock              *DBContextMock
   970  	mainExpectation   *DBContextMockViewExpectation
   971  	expectationSeries []*DBContextMockViewExpectation
   972  }
   973  
   974  type DBContextMockViewExpectation struct {
   975  	input  *DBContextMockViewInput
   976  	result *DBContextMockViewResult
   977  }
   978  
   979  type DBContextMockViewInput struct {
   980  	p  context.Context
   981  	p1 func(p *TransactionManager) (r error)
   982  }
   983  
   984  type DBContextMockViewResult struct {
   985  	r error
   986  }
   987  
   988  //Expect specifies that invocation of DBContext.View is expected from 1 to Infinity times
   989  func (m *mDBContextMockView) Expect(p context.Context, p1 func(p *TransactionManager) (r error)) *mDBContextMockView {
   990  	m.mock.ViewFunc = nil
   991  	m.expectationSeries = nil
   992  
   993  	if m.mainExpectation == nil {
   994  		m.mainExpectation = &DBContextMockViewExpectation{}
   995  	}
   996  	m.mainExpectation.input = &DBContextMockViewInput{p, p1}
   997  	return m
   998  }
   999  
  1000  //Return specifies results of invocation of DBContext.View
  1001  func (m *mDBContextMockView) Return(r error) *DBContextMock {
  1002  	m.mock.ViewFunc = nil
  1003  	m.expectationSeries = nil
  1004  
  1005  	if m.mainExpectation == nil {
  1006  		m.mainExpectation = &DBContextMockViewExpectation{}
  1007  	}
  1008  	m.mainExpectation.result = &DBContextMockViewResult{r}
  1009  	return m.mock
  1010  }
  1011  
  1012  //ExpectOnce specifies that invocation of DBContext.View is expected once
  1013  func (m *mDBContextMockView) ExpectOnce(p context.Context, p1 func(p *TransactionManager) (r error)) *DBContextMockViewExpectation {
  1014  	m.mock.ViewFunc = nil
  1015  	m.mainExpectation = nil
  1016  
  1017  	expectation := &DBContextMockViewExpectation{}
  1018  	expectation.input = &DBContextMockViewInput{p, p1}
  1019  	m.expectationSeries = append(m.expectationSeries, expectation)
  1020  	return expectation
  1021  }
  1022  
  1023  func (e *DBContextMockViewExpectation) Return(r error) {
  1024  	e.result = &DBContextMockViewResult{r}
  1025  }
  1026  
  1027  //Set uses given function f as a mock of DBContext.View method
  1028  func (m *mDBContextMockView) Set(f func(p context.Context, p1 func(p *TransactionManager) (r error)) (r error)) *DBContextMock {
  1029  	m.mainExpectation = nil
  1030  	m.expectationSeries = nil
  1031  
  1032  	m.mock.ViewFunc = f
  1033  	return m.mock
  1034  }
  1035  
  1036  //View implements github.com/insolar/insolar/ledger/storage.DBContext interface
  1037  func (m *DBContextMock) View(p context.Context, p1 func(p *TransactionManager) (r error)) (r error) {
  1038  	counter := atomic.AddUint64(&m.ViewPreCounter, 1)
  1039  	defer atomic.AddUint64(&m.ViewCounter, 1)
  1040  
  1041  	if len(m.ViewMock.expectationSeries) > 0 {
  1042  		if counter > uint64(len(m.ViewMock.expectationSeries)) {
  1043  			m.t.Fatalf("Unexpected call to DBContextMock.View. %v %v", p, p1)
  1044  			return
  1045  		}
  1046  
  1047  		input := m.ViewMock.expectationSeries[counter-1].input
  1048  		testify_assert.Equal(m.t, *input, DBContextMockViewInput{p, p1}, "DBContext.View got unexpected parameters")
  1049  
  1050  		result := m.ViewMock.expectationSeries[counter-1].result
  1051  		if result == nil {
  1052  			m.t.Fatal("No results are set for the DBContextMock.View")
  1053  			return
  1054  		}
  1055  
  1056  		r = result.r
  1057  
  1058  		return
  1059  	}
  1060  
  1061  	if m.ViewMock.mainExpectation != nil {
  1062  
  1063  		input := m.ViewMock.mainExpectation.input
  1064  		if input != nil {
  1065  			testify_assert.Equal(m.t, *input, DBContextMockViewInput{p, p1}, "DBContext.View got unexpected parameters")
  1066  		}
  1067  
  1068  		result := m.ViewMock.mainExpectation.result
  1069  		if result == nil {
  1070  			m.t.Fatal("No results are set for the DBContextMock.View")
  1071  		}
  1072  
  1073  		r = result.r
  1074  
  1075  		return
  1076  	}
  1077  
  1078  	if m.ViewFunc == nil {
  1079  		m.t.Fatalf("Unexpected call to DBContextMock.View. %v %v", p, p1)
  1080  		return
  1081  	}
  1082  
  1083  	return m.ViewFunc(p, p1)
  1084  }
  1085  
  1086  //ViewMinimockCounter returns a count of DBContextMock.ViewFunc invocations
  1087  func (m *DBContextMock) ViewMinimockCounter() uint64 {
  1088  	return atomic.LoadUint64(&m.ViewCounter)
  1089  }
  1090  
  1091  //ViewMinimockPreCounter returns the value of DBContextMock.View invocations
  1092  func (m *DBContextMock) ViewMinimockPreCounter() uint64 {
  1093  	return atomic.LoadUint64(&m.ViewPreCounter)
  1094  }
  1095  
  1096  //ViewFinished returns true if mock invocations count is ok
  1097  func (m *DBContextMock) ViewFinished() bool {
  1098  	// if expectation series were set then invocations count should be equal to expectations count
  1099  	if len(m.ViewMock.expectationSeries) > 0 {
  1100  		return atomic.LoadUint64(&m.ViewCounter) == uint64(len(m.ViewMock.expectationSeries))
  1101  	}
  1102  
  1103  	// if main expectation was set then invocations count should be greater than zero
  1104  	if m.ViewMock.mainExpectation != nil {
  1105  		return atomic.LoadUint64(&m.ViewCounter) > 0
  1106  	}
  1107  
  1108  	// if func was set then invocations count should be greater than zero
  1109  	if m.ViewFunc != nil {
  1110  		return atomic.LoadUint64(&m.ViewCounter) > 0
  1111  	}
  1112  
  1113  	return true
  1114  }
  1115  
  1116  type mDBContextMockget struct {
  1117  	mock              *DBContextMock
  1118  	mainExpectation   *DBContextMockgetExpectation
  1119  	expectationSeries []*DBContextMockgetExpectation
  1120  }
  1121  
  1122  type DBContextMockgetExpectation struct {
  1123  	input  *DBContextMockgetInput
  1124  	result *DBContextMockgetResult
  1125  }
  1126  
  1127  type DBContextMockgetInput struct {
  1128  	p  context.Context
  1129  	p1 []byte
  1130  }
  1131  
  1132  type DBContextMockgetResult struct {
  1133  	r  []byte
  1134  	r1 error
  1135  }
  1136  
  1137  //Expect specifies that invocation of DBContext.get is expected from 1 to Infinity times
  1138  func (m *mDBContextMockget) Expect(p context.Context, p1 []byte) *mDBContextMockget {
  1139  	m.mock.getFunc = nil
  1140  	m.expectationSeries = nil
  1141  
  1142  	if m.mainExpectation == nil {
  1143  		m.mainExpectation = &DBContextMockgetExpectation{}
  1144  	}
  1145  	m.mainExpectation.input = &DBContextMockgetInput{p, p1}
  1146  	return m
  1147  }
  1148  
  1149  //Return specifies results of invocation of DBContext.get
  1150  func (m *mDBContextMockget) Return(r []byte, r1 error) *DBContextMock {
  1151  	m.mock.getFunc = nil
  1152  	m.expectationSeries = nil
  1153  
  1154  	if m.mainExpectation == nil {
  1155  		m.mainExpectation = &DBContextMockgetExpectation{}
  1156  	}
  1157  	m.mainExpectation.result = &DBContextMockgetResult{r, r1}
  1158  	return m.mock
  1159  }
  1160  
  1161  //ExpectOnce specifies that invocation of DBContext.get is expected once
  1162  func (m *mDBContextMockget) ExpectOnce(p context.Context, p1 []byte) *DBContextMockgetExpectation {
  1163  	m.mock.getFunc = nil
  1164  	m.mainExpectation = nil
  1165  
  1166  	expectation := &DBContextMockgetExpectation{}
  1167  	expectation.input = &DBContextMockgetInput{p, p1}
  1168  	m.expectationSeries = append(m.expectationSeries, expectation)
  1169  	return expectation
  1170  }
  1171  
  1172  func (e *DBContextMockgetExpectation) Return(r []byte, r1 error) {
  1173  	e.result = &DBContextMockgetResult{r, r1}
  1174  }
  1175  
  1176  //Set uses given function f as a mock of DBContext.get method
  1177  func (m *mDBContextMockget) Set(f func(p context.Context, p1 []byte) (r []byte, r1 error)) *DBContextMock {
  1178  	m.mainExpectation = nil
  1179  	m.expectationSeries = nil
  1180  
  1181  	m.mock.getFunc = f
  1182  	return m.mock
  1183  }
  1184  
  1185  //get implements github.com/insolar/insolar/ledger/storage.DBContext interface
  1186  func (m *DBContextMock) get(p context.Context, p1 []byte) (r []byte, r1 error) {
  1187  	counter := atomic.AddUint64(&m.getPreCounter, 1)
  1188  	defer atomic.AddUint64(&m.getCounter, 1)
  1189  
  1190  	if len(m.getMock.expectationSeries) > 0 {
  1191  		if counter > uint64(len(m.getMock.expectationSeries)) {
  1192  			m.t.Fatalf("Unexpected call to DBContextMock.get. %v %v", p, p1)
  1193  			return
  1194  		}
  1195  
  1196  		input := m.getMock.expectationSeries[counter-1].input
  1197  		testify_assert.Equal(m.t, *input, DBContextMockgetInput{p, p1}, "DBContext.get got unexpected parameters")
  1198  
  1199  		result := m.getMock.expectationSeries[counter-1].result
  1200  		if result == nil {
  1201  			m.t.Fatal("No results are set for the DBContextMock.get")
  1202  			return
  1203  		}
  1204  
  1205  		r = result.r
  1206  		r1 = result.r1
  1207  
  1208  		return
  1209  	}
  1210  
  1211  	if m.getMock.mainExpectation != nil {
  1212  
  1213  		input := m.getMock.mainExpectation.input
  1214  		if input != nil {
  1215  			testify_assert.Equal(m.t, *input, DBContextMockgetInput{p, p1}, "DBContext.get got unexpected parameters")
  1216  		}
  1217  
  1218  		result := m.getMock.mainExpectation.result
  1219  		if result == nil {
  1220  			m.t.Fatal("No results are set for the DBContextMock.get")
  1221  		}
  1222  
  1223  		r = result.r
  1224  		r1 = result.r1
  1225  
  1226  		return
  1227  	}
  1228  
  1229  	if m.getFunc == nil {
  1230  		m.t.Fatalf("Unexpected call to DBContextMock.get. %v %v", p, p1)
  1231  		return
  1232  	}
  1233  
  1234  	return m.getFunc(p, p1)
  1235  }
  1236  
  1237  //getMinimockCounter returns a count of DBContextMock.getFunc invocations
  1238  func (m *DBContextMock) getMinimockCounter() uint64 {
  1239  	return atomic.LoadUint64(&m.getCounter)
  1240  }
  1241  
  1242  //getMinimockPreCounter returns the value of DBContextMock.get invocations
  1243  func (m *DBContextMock) getMinimockPreCounter() uint64 {
  1244  	return atomic.LoadUint64(&m.getPreCounter)
  1245  }
  1246  
  1247  //getFinished returns true if mock invocations count is ok
  1248  func (m *DBContextMock) getFinished() bool {
  1249  	// if expectation series were set then invocations count should be equal to expectations count
  1250  	if len(m.getMock.expectationSeries) > 0 {
  1251  		return atomic.LoadUint64(&m.getCounter) == uint64(len(m.getMock.expectationSeries))
  1252  	}
  1253  
  1254  	// if main expectation was set then invocations count should be greater than zero
  1255  	if m.getMock.mainExpectation != nil {
  1256  		return atomic.LoadUint64(&m.getCounter) > 0
  1257  	}
  1258  
  1259  	// if func was set then invocations count should be greater than zero
  1260  	if m.getFunc != nil {
  1261  		return atomic.LoadUint64(&m.getCounter) > 0
  1262  	}
  1263  
  1264  	return true
  1265  }
  1266  
  1267  type mDBContextMockiterate struct {
  1268  	mock              *DBContextMock
  1269  	mainExpectation   *DBContextMockiterateExpectation
  1270  	expectationSeries []*DBContextMockiterateExpectation
  1271  }
  1272  
  1273  type DBContextMockiterateExpectation struct {
  1274  	input  *DBContextMockiterateInput
  1275  	result *DBContextMockiterateResult
  1276  }
  1277  
  1278  type DBContextMockiterateInput struct {
  1279  	p  context.Context
  1280  	p1 []byte
  1281  	p2 func(p []byte, p1 []byte) (r error)
  1282  }
  1283  
  1284  type DBContextMockiterateResult struct {
  1285  	r error
  1286  }
  1287  
  1288  //Expect specifies that invocation of DBContext.iterate is expected from 1 to Infinity times
  1289  func (m *mDBContextMockiterate) Expect(p context.Context, p1 []byte, p2 func(p []byte, p1 []byte) (r error)) *mDBContextMockiterate {
  1290  	m.mock.iterateFunc = nil
  1291  	m.expectationSeries = nil
  1292  
  1293  	if m.mainExpectation == nil {
  1294  		m.mainExpectation = &DBContextMockiterateExpectation{}
  1295  	}
  1296  	m.mainExpectation.input = &DBContextMockiterateInput{p, p1, p2}
  1297  	return m
  1298  }
  1299  
  1300  //Return specifies results of invocation of DBContext.iterate
  1301  func (m *mDBContextMockiterate) Return(r error) *DBContextMock {
  1302  	m.mock.iterateFunc = nil
  1303  	m.expectationSeries = nil
  1304  
  1305  	if m.mainExpectation == nil {
  1306  		m.mainExpectation = &DBContextMockiterateExpectation{}
  1307  	}
  1308  	m.mainExpectation.result = &DBContextMockiterateResult{r}
  1309  	return m.mock
  1310  }
  1311  
  1312  //ExpectOnce specifies that invocation of DBContext.iterate is expected once
  1313  func (m *mDBContextMockiterate) ExpectOnce(p context.Context, p1 []byte, p2 func(p []byte, p1 []byte) (r error)) *DBContextMockiterateExpectation {
  1314  	m.mock.iterateFunc = nil
  1315  	m.mainExpectation = nil
  1316  
  1317  	expectation := &DBContextMockiterateExpectation{}
  1318  	expectation.input = &DBContextMockiterateInput{p, p1, p2}
  1319  	m.expectationSeries = append(m.expectationSeries, expectation)
  1320  	return expectation
  1321  }
  1322  
  1323  func (e *DBContextMockiterateExpectation) Return(r error) {
  1324  	e.result = &DBContextMockiterateResult{r}
  1325  }
  1326  
  1327  //Set uses given function f as a mock of DBContext.iterate method
  1328  func (m *mDBContextMockiterate) Set(f func(p context.Context, p1 []byte, p2 func(p []byte, p1 []byte) (r error)) (r error)) *DBContextMock {
  1329  	m.mainExpectation = nil
  1330  	m.expectationSeries = nil
  1331  
  1332  	m.mock.iterateFunc = f
  1333  	return m.mock
  1334  }
  1335  
  1336  //iterate implements github.com/insolar/insolar/ledger/storage.DBContext interface
  1337  func (m *DBContextMock) iterate(p context.Context, p1 []byte, p2 func(p []byte, p1 []byte) (r error)) (r error) {
  1338  	counter := atomic.AddUint64(&m.iteratePreCounter, 1)
  1339  	defer atomic.AddUint64(&m.iterateCounter, 1)
  1340  
  1341  	if len(m.iterateMock.expectationSeries) > 0 {
  1342  		if counter > uint64(len(m.iterateMock.expectationSeries)) {
  1343  			m.t.Fatalf("Unexpected call to DBContextMock.iterate. %v %v %v", p, p1, p2)
  1344  			return
  1345  		}
  1346  
  1347  		input := m.iterateMock.expectationSeries[counter-1].input
  1348  		testify_assert.Equal(m.t, *input, DBContextMockiterateInput{p, p1, p2}, "DBContext.iterate got unexpected parameters")
  1349  
  1350  		result := m.iterateMock.expectationSeries[counter-1].result
  1351  		if result == nil {
  1352  			m.t.Fatal("No results are set for the DBContextMock.iterate")
  1353  			return
  1354  		}
  1355  
  1356  		r = result.r
  1357  
  1358  		return
  1359  	}
  1360  
  1361  	if m.iterateMock.mainExpectation != nil {
  1362  
  1363  		input := m.iterateMock.mainExpectation.input
  1364  		if input != nil {
  1365  			testify_assert.Equal(m.t, *input, DBContextMockiterateInput{p, p1, p2}, "DBContext.iterate got unexpected parameters")
  1366  		}
  1367  
  1368  		result := m.iterateMock.mainExpectation.result
  1369  		if result == nil {
  1370  			m.t.Fatal("No results are set for the DBContextMock.iterate")
  1371  		}
  1372  
  1373  		r = result.r
  1374  
  1375  		return
  1376  	}
  1377  
  1378  	if m.iterateFunc == nil {
  1379  		m.t.Fatalf("Unexpected call to DBContextMock.iterate. %v %v %v", p, p1, p2)
  1380  		return
  1381  	}
  1382  
  1383  	return m.iterateFunc(p, p1, p2)
  1384  }
  1385  
  1386  //iterateMinimockCounter returns a count of DBContextMock.iterateFunc invocations
  1387  func (m *DBContextMock) iterateMinimockCounter() uint64 {
  1388  	return atomic.LoadUint64(&m.iterateCounter)
  1389  }
  1390  
  1391  //iterateMinimockPreCounter returns the value of DBContextMock.iterate invocations
  1392  func (m *DBContextMock) iterateMinimockPreCounter() uint64 {
  1393  	return atomic.LoadUint64(&m.iteratePreCounter)
  1394  }
  1395  
  1396  //iterateFinished returns true if mock invocations count is ok
  1397  func (m *DBContextMock) iterateFinished() bool {
  1398  	// if expectation series were set then invocations count should be equal to expectations count
  1399  	if len(m.iterateMock.expectationSeries) > 0 {
  1400  		return atomic.LoadUint64(&m.iterateCounter) == uint64(len(m.iterateMock.expectationSeries))
  1401  	}
  1402  
  1403  	// if main expectation was set then invocations count should be greater than zero
  1404  	if m.iterateMock.mainExpectation != nil {
  1405  		return atomic.LoadUint64(&m.iterateCounter) > 0
  1406  	}
  1407  
  1408  	// if func was set then invocations count should be greater than zero
  1409  	if m.iterateFunc != nil {
  1410  		return atomic.LoadUint64(&m.iterateCounter) > 0
  1411  	}
  1412  
  1413  	return true
  1414  }
  1415  
  1416  type mDBContextMockset struct {
  1417  	mock              *DBContextMock
  1418  	mainExpectation   *DBContextMocksetExpectation
  1419  	expectationSeries []*DBContextMocksetExpectation
  1420  }
  1421  
  1422  type DBContextMocksetExpectation struct {
  1423  	input  *DBContextMocksetInput
  1424  	result *DBContextMocksetResult
  1425  }
  1426  
  1427  type DBContextMocksetInput struct {
  1428  	p  context.Context
  1429  	p1 []byte
  1430  	p2 []byte
  1431  }
  1432  
  1433  type DBContextMocksetResult struct {
  1434  	r error
  1435  }
  1436  
  1437  //Expect specifies that invocation of DBContext.set is expected from 1 to Infinity times
  1438  func (m *mDBContextMockset) Expect(p context.Context, p1 []byte, p2 []byte) *mDBContextMockset {
  1439  	m.mock.setFunc = nil
  1440  	m.expectationSeries = nil
  1441  
  1442  	if m.mainExpectation == nil {
  1443  		m.mainExpectation = &DBContextMocksetExpectation{}
  1444  	}
  1445  	m.mainExpectation.input = &DBContextMocksetInput{p, p1, p2}
  1446  	return m
  1447  }
  1448  
  1449  //Return specifies results of invocation of DBContext.set
  1450  func (m *mDBContextMockset) Return(r error) *DBContextMock {
  1451  	m.mock.setFunc = nil
  1452  	m.expectationSeries = nil
  1453  
  1454  	if m.mainExpectation == nil {
  1455  		m.mainExpectation = &DBContextMocksetExpectation{}
  1456  	}
  1457  	m.mainExpectation.result = &DBContextMocksetResult{r}
  1458  	return m.mock
  1459  }
  1460  
  1461  //ExpectOnce specifies that invocation of DBContext.set is expected once
  1462  func (m *mDBContextMockset) ExpectOnce(p context.Context, p1 []byte, p2 []byte) *DBContextMocksetExpectation {
  1463  	m.mock.setFunc = nil
  1464  	m.mainExpectation = nil
  1465  
  1466  	expectation := &DBContextMocksetExpectation{}
  1467  	expectation.input = &DBContextMocksetInput{p, p1, p2}
  1468  	m.expectationSeries = append(m.expectationSeries, expectation)
  1469  	return expectation
  1470  }
  1471  
  1472  func (e *DBContextMocksetExpectation) Return(r error) {
  1473  	e.result = &DBContextMocksetResult{r}
  1474  }
  1475  
  1476  //Set uses given function f as a mock of DBContext.set method
  1477  func (m *mDBContextMockset) Set(f func(p context.Context, p1 []byte, p2 []byte) (r error)) *DBContextMock {
  1478  	m.mainExpectation = nil
  1479  	m.expectationSeries = nil
  1480  
  1481  	m.mock.setFunc = f
  1482  	return m.mock
  1483  }
  1484  
  1485  //set implements github.com/insolar/insolar/ledger/storage.DBContext interface
  1486  func (m *DBContextMock) set(p context.Context, p1 []byte, p2 []byte) (r error) {
  1487  	counter := atomic.AddUint64(&m.setPreCounter, 1)
  1488  	defer atomic.AddUint64(&m.setCounter, 1)
  1489  
  1490  	if len(m.setMock.expectationSeries) > 0 {
  1491  		if counter > uint64(len(m.setMock.expectationSeries)) {
  1492  			m.t.Fatalf("Unexpected call to DBContextMock.set. %v %v %v", p, p1, p2)
  1493  			return
  1494  		}
  1495  
  1496  		input := m.setMock.expectationSeries[counter-1].input
  1497  		testify_assert.Equal(m.t, *input, DBContextMocksetInput{p, p1, p2}, "DBContext.set got unexpected parameters")
  1498  
  1499  		result := m.setMock.expectationSeries[counter-1].result
  1500  		if result == nil {
  1501  			m.t.Fatal("No results are set for the DBContextMock.set")
  1502  			return
  1503  		}
  1504  
  1505  		r = result.r
  1506  
  1507  		return
  1508  	}
  1509  
  1510  	if m.setMock.mainExpectation != nil {
  1511  
  1512  		input := m.setMock.mainExpectation.input
  1513  		if input != nil {
  1514  			testify_assert.Equal(m.t, *input, DBContextMocksetInput{p, p1, p2}, "DBContext.set got unexpected parameters")
  1515  		}
  1516  
  1517  		result := m.setMock.mainExpectation.result
  1518  		if result == nil {
  1519  			m.t.Fatal("No results are set for the DBContextMock.set")
  1520  		}
  1521  
  1522  		r = result.r
  1523  
  1524  		return
  1525  	}
  1526  
  1527  	if m.setFunc == nil {
  1528  		m.t.Fatalf("Unexpected call to DBContextMock.set. %v %v %v", p, p1, p2)
  1529  		return
  1530  	}
  1531  
  1532  	return m.setFunc(p, p1, p2)
  1533  }
  1534  
  1535  //setMinimockCounter returns a count of DBContextMock.setFunc invocations
  1536  func (m *DBContextMock) setMinimockCounter() uint64 {
  1537  	return atomic.LoadUint64(&m.setCounter)
  1538  }
  1539  
  1540  //setMinimockPreCounter returns the value of DBContextMock.set invocations
  1541  func (m *DBContextMock) setMinimockPreCounter() uint64 {
  1542  	return atomic.LoadUint64(&m.setPreCounter)
  1543  }
  1544  
  1545  //setFinished returns true if mock invocations count is ok
  1546  func (m *DBContextMock) setFinished() bool {
  1547  	// if expectation series were set then invocations count should be equal to expectations count
  1548  	if len(m.setMock.expectationSeries) > 0 {
  1549  		return atomic.LoadUint64(&m.setCounter) == uint64(len(m.setMock.expectationSeries))
  1550  	}
  1551  
  1552  	// if main expectation was set then invocations count should be greater than zero
  1553  	if m.setMock.mainExpectation != nil {
  1554  		return atomic.LoadUint64(&m.setCounter) > 0
  1555  	}
  1556  
  1557  	// if func was set then invocations count should be greater than zero
  1558  	if m.setFunc != nil {
  1559  		return atomic.LoadUint64(&m.setCounter) > 0
  1560  	}
  1561  
  1562  	return true
  1563  }
  1564  
  1565  type mDBContextMockwaitingFlight struct {
  1566  	mock              *DBContextMock
  1567  	mainExpectation   *DBContextMockwaitingFlightExpectation
  1568  	expectationSeries []*DBContextMockwaitingFlightExpectation
  1569  }
  1570  
  1571  type DBContextMockwaitingFlightExpectation struct {
  1572  }
  1573  
  1574  //Expect specifies that invocation of DBContext.waitingFlight is expected from 1 to Infinity times
  1575  func (m *mDBContextMockwaitingFlight) Expect() *mDBContextMockwaitingFlight {
  1576  	m.mock.waitingFlightFunc = nil
  1577  	m.expectationSeries = nil
  1578  
  1579  	if m.mainExpectation == nil {
  1580  		m.mainExpectation = &DBContextMockwaitingFlightExpectation{}
  1581  	}
  1582  
  1583  	return m
  1584  }
  1585  
  1586  //Return specifies results of invocation of DBContext.waitingFlight
  1587  func (m *mDBContextMockwaitingFlight) Return() *DBContextMock {
  1588  	m.mock.waitingFlightFunc = nil
  1589  	m.expectationSeries = nil
  1590  
  1591  	if m.mainExpectation == nil {
  1592  		m.mainExpectation = &DBContextMockwaitingFlightExpectation{}
  1593  	}
  1594  
  1595  	return m.mock
  1596  }
  1597  
  1598  //ExpectOnce specifies that invocation of DBContext.waitingFlight is expected once
  1599  func (m *mDBContextMockwaitingFlight) ExpectOnce() *DBContextMockwaitingFlightExpectation {
  1600  	m.mock.waitingFlightFunc = nil
  1601  	m.mainExpectation = nil
  1602  
  1603  	expectation := &DBContextMockwaitingFlightExpectation{}
  1604  
  1605  	m.expectationSeries = append(m.expectationSeries, expectation)
  1606  	return expectation
  1607  }
  1608  
  1609  //Set uses given function f as a mock of DBContext.waitingFlight method
  1610  func (m *mDBContextMockwaitingFlight) Set(f func()) *DBContextMock {
  1611  	m.mainExpectation = nil
  1612  	m.expectationSeries = nil
  1613  
  1614  	m.mock.waitingFlightFunc = f
  1615  	return m.mock
  1616  }
  1617  
  1618  //waitingFlight implements github.com/insolar/insolar/ledger/storage.DBContext interface
  1619  func (m *DBContextMock) waitingFlight() {
  1620  	counter := atomic.AddUint64(&m.waitingFlightPreCounter, 1)
  1621  	defer atomic.AddUint64(&m.waitingFlightCounter, 1)
  1622  
  1623  	if len(m.waitingFlightMock.expectationSeries) > 0 {
  1624  		if counter > uint64(len(m.waitingFlightMock.expectationSeries)) {
  1625  			m.t.Fatalf("Unexpected call to DBContextMock.waitingFlight.")
  1626  			return
  1627  		}
  1628  
  1629  		return
  1630  	}
  1631  
  1632  	if m.waitingFlightMock.mainExpectation != nil {
  1633  
  1634  		return
  1635  	}
  1636  
  1637  	if m.waitingFlightFunc == nil {
  1638  		m.t.Fatalf("Unexpected call to DBContextMock.waitingFlight.")
  1639  		return
  1640  	}
  1641  
  1642  	m.waitingFlightFunc()
  1643  }
  1644  
  1645  //waitingFlightMinimockCounter returns a count of DBContextMock.waitingFlightFunc invocations
  1646  func (m *DBContextMock) waitingFlightMinimockCounter() uint64 {
  1647  	return atomic.LoadUint64(&m.waitingFlightCounter)
  1648  }
  1649  
  1650  //waitingFlightMinimockPreCounter returns the value of DBContextMock.waitingFlight invocations
  1651  func (m *DBContextMock) waitingFlightMinimockPreCounter() uint64 {
  1652  	return atomic.LoadUint64(&m.waitingFlightPreCounter)
  1653  }
  1654  
  1655  //waitingFlightFinished returns true if mock invocations count is ok
  1656  func (m *DBContextMock) waitingFlightFinished() bool {
  1657  	// if expectation series were set then invocations count should be equal to expectations count
  1658  	if len(m.waitingFlightMock.expectationSeries) > 0 {
  1659  		return atomic.LoadUint64(&m.waitingFlightCounter) == uint64(len(m.waitingFlightMock.expectationSeries))
  1660  	}
  1661  
  1662  	// if main expectation was set then invocations count should be greater than zero
  1663  	if m.waitingFlightMock.mainExpectation != nil {
  1664  		return atomic.LoadUint64(&m.waitingFlightCounter) > 0
  1665  	}
  1666  
  1667  	// if func was set then invocations count should be greater than zero
  1668  	if m.waitingFlightFunc != nil {
  1669  		return atomic.LoadUint64(&m.waitingFlightCounter) > 0
  1670  	}
  1671  
  1672  	return true
  1673  }
  1674  
  1675  //ValidateCallCounters checks that all mocked methods of the interface have been called at least once
  1676  //Deprecated: please use MinimockFinish method or use Finish method of minimock.Controller
  1677  func (m *DBContextMock) ValidateCallCounters() {
  1678  
  1679  	if !m.BeginTransactionFinished() {
  1680  		m.t.Fatal("Expected call to DBContextMock.BeginTransaction")
  1681  	}
  1682  
  1683  	if !m.CloseFinished() {
  1684  		m.t.Fatal("Expected call to DBContextMock.Close")
  1685  	}
  1686  
  1687  	if !m.GetBadgerDBFinished() {
  1688  		m.t.Fatal("Expected call to DBContextMock.GetBadgerDB")
  1689  	}
  1690  
  1691  	if !m.IterateRecordsOnPulseFinished() {
  1692  		m.t.Fatal("Expected call to DBContextMock.IterateRecordsOnPulse")
  1693  	}
  1694  
  1695  	if !m.StoreKeyValuesFinished() {
  1696  		m.t.Fatal("Expected call to DBContextMock.StoreKeyValues")
  1697  	}
  1698  
  1699  	if !m.UpdateFinished() {
  1700  		m.t.Fatal("Expected call to DBContextMock.Update")
  1701  	}
  1702  
  1703  	if !m.ViewFinished() {
  1704  		m.t.Fatal("Expected call to DBContextMock.View")
  1705  	}
  1706  
  1707  	if !m.getFinished() {
  1708  		m.t.Fatal("Expected call to DBContextMock.get")
  1709  	}
  1710  
  1711  	if !m.iterateFinished() {
  1712  		m.t.Fatal("Expected call to DBContextMock.iterate")
  1713  	}
  1714  
  1715  	if !m.setFinished() {
  1716  		m.t.Fatal("Expected call to DBContextMock.set")
  1717  	}
  1718  
  1719  	if !m.waitingFlightFinished() {
  1720  		m.t.Fatal("Expected call to DBContextMock.waitingFlight")
  1721  	}
  1722  
  1723  }
  1724  
  1725  //CheckMocksCalled checks that all mocked methods of the interface have been called at least once
  1726  //Deprecated: please use MinimockFinish method or use Finish method of minimock.Controller
  1727  func (m *DBContextMock) CheckMocksCalled() {
  1728  	m.Finish()
  1729  }
  1730  
  1731  //Finish checks that all mocked methods of the interface have been called at least once
  1732  //Deprecated: please use MinimockFinish or use Finish method of minimock.Controller
  1733  func (m *DBContextMock) Finish() {
  1734  	m.MinimockFinish()
  1735  }
  1736  
  1737  //MinimockFinish checks that all mocked methods of the interface have been called at least once
  1738  func (m *DBContextMock) MinimockFinish() {
  1739  
  1740  	if !m.BeginTransactionFinished() {
  1741  		m.t.Fatal("Expected call to DBContextMock.BeginTransaction")
  1742  	}
  1743  
  1744  	if !m.CloseFinished() {
  1745  		m.t.Fatal("Expected call to DBContextMock.Close")
  1746  	}
  1747  
  1748  	if !m.GetBadgerDBFinished() {
  1749  		m.t.Fatal("Expected call to DBContextMock.GetBadgerDB")
  1750  	}
  1751  
  1752  	if !m.IterateRecordsOnPulseFinished() {
  1753  		m.t.Fatal("Expected call to DBContextMock.IterateRecordsOnPulse")
  1754  	}
  1755  
  1756  	if !m.StoreKeyValuesFinished() {
  1757  		m.t.Fatal("Expected call to DBContextMock.StoreKeyValues")
  1758  	}
  1759  
  1760  	if !m.UpdateFinished() {
  1761  		m.t.Fatal("Expected call to DBContextMock.Update")
  1762  	}
  1763  
  1764  	if !m.ViewFinished() {
  1765  		m.t.Fatal("Expected call to DBContextMock.View")
  1766  	}
  1767  
  1768  	if !m.getFinished() {
  1769  		m.t.Fatal("Expected call to DBContextMock.get")
  1770  	}
  1771  
  1772  	if !m.iterateFinished() {
  1773  		m.t.Fatal("Expected call to DBContextMock.iterate")
  1774  	}
  1775  
  1776  	if !m.setFinished() {
  1777  		m.t.Fatal("Expected call to DBContextMock.set")
  1778  	}
  1779  
  1780  	if !m.waitingFlightFinished() {
  1781  		m.t.Fatal("Expected call to DBContextMock.waitingFlight")
  1782  	}
  1783  
  1784  }
  1785  
  1786  //Wait waits for all mocked methods to be called at least once
  1787  //Deprecated: please use MinimockWait or use Wait method of minimock.Controller
  1788  func (m *DBContextMock) Wait(timeout time.Duration) {
  1789  	m.MinimockWait(timeout)
  1790  }
  1791  
  1792  //MinimockWait waits for all mocked methods to be called at least once
  1793  //this method is called by minimock.Controller
  1794  func (m *DBContextMock) MinimockWait(timeout time.Duration) {
  1795  	timeoutCh := time.After(timeout)
  1796  	for {
  1797  		ok := true
  1798  		ok = ok && m.BeginTransactionFinished()
  1799  		ok = ok && m.CloseFinished()
  1800  		ok = ok && m.GetBadgerDBFinished()
  1801  		ok = ok && m.IterateRecordsOnPulseFinished()
  1802  		ok = ok && m.StoreKeyValuesFinished()
  1803  		ok = ok && m.UpdateFinished()
  1804  		ok = ok && m.ViewFinished()
  1805  		ok = ok && m.getFinished()
  1806  		ok = ok && m.iterateFinished()
  1807  		ok = ok && m.setFinished()
  1808  		ok = ok && m.waitingFlightFinished()
  1809  
  1810  		if ok {
  1811  			return
  1812  		}
  1813  
  1814  		select {
  1815  		case <-timeoutCh:
  1816  
  1817  			if !m.BeginTransactionFinished() {
  1818  				m.t.Error("Expected call to DBContextMock.BeginTransaction")
  1819  			}
  1820  
  1821  			if !m.CloseFinished() {
  1822  				m.t.Error("Expected call to DBContextMock.Close")
  1823  			}
  1824  
  1825  			if !m.GetBadgerDBFinished() {
  1826  				m.t.Error("Expected call to DBContextMock.GetBadgerDB")
  1827  			}
  1828  
  1829  			if !m.IterateRecordsOnPulseFinished() {
  1830  				m.t.Error("Expected call to DBContextMock.IterateRecordsOnPulse")
  1831  			}
  1832  
  1833  			if !m.StoreKeyValuesFinished() {
  1834  				m.t.Error("Expected call to DBContextMock.StoreKeyValues")
  1835  			}
  1836  
  1837  			if !m.UpdateFinished() {
  1838  				m.t.Error("Expected call to DBContextMock.Update")
  1839  			}
  1840  
  1841  			if !m.ViewFinished() {
  1842  				m.t.Error("Expected call to DBContextMock.View")
  1843  			}
  1844  
  1845  			if !m.getFinished() {
  1846  				m.t.Error("Expected call to DBContextMock.get")
  1847  			}
  1848  
  1849  			if !m.iterateFinished() {
  1850  				m.t.Error("Expected call to DBContextMock.iterate")
  1851  			}
  1852  
  1853  			if !m.setFinished() {
  1854  				m.t.Error("Expected call to DBContextMock.set")
  1855  			}
  1856  
  1857  			if !m.waitingFlightFinished() {
  1858  				m.t.Error("Expected call to DBContextMock.waitingFlight")
  1859  			}
  1860  
  1861  			m.t.Fatalf("Some mocks were not called on time: %s", timeout)
  1862  			return
  1863  		default:
  1864  			time.Sleep(time.Millisecond)
  1865  		}
  1866  	}
  1867  }
  1868  
  1869  //AllMocksCalled returns true if all mocked methods were called before the execution of AllMocksCalled,
  1870  //it can be used with assert/require, i.e. assert.True(mock.AllMocksCalled())
  1871  func (m *DBContextMock) AllMocksCalled() bool {
  1872  
  1873  	if !m.BeginTransactionFinished() {
  1874  		return false
  1875  	}
  1876  
  1877  	if !m.CloseFinished() {
  1878  		return false
  1879  	}
  1880  
  1881  	if !m.GetBadgerDBFinished() {
  1882  		return false
  1883  	}
  1884  
  1885  	if !m.IterateRecordsOnPulseFinished() {
  1886  		return false
  1887  	}
  1888  
  1889  	if !m.StoreKeyValuesFinished() {
  1890  		return false
  1891  	}
  1892  
  1893  	if !m.UpdateFinished() {
  1894  		return false
  1895  	}
  1896  
  1897  	if !m.ViewFinished() {
  1898  		return false
  1899  	}
  1900  
  1901  	if !m.getFinished() {
  1902  		return false
  1903  	}
  1904  
  1905  	if !m.iterateFinished() {
  1906  		return false
  1907  	}
  1908  
  1909  	if !m.setFinished() {
  1910  		return false
  1911  	}
  1912  
  1913  	if !m.waitingFlightFinished() {
  1914  		return false
  1915  	}
  1916  
  1917  	return true
  1918  }