github.com/braveheart12/insolar-09-08-19@v0.8.7/testutils/heavy_sync_mock.go (about)

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