github.com/oinume/lekcije@v0.0.0-20231017100347-5b4c5eb6ab24/backend/domain/repository/lesson.moq.go (about)

     1  // Code generated by moq; DO NOT EDIT.
     2  // github.com/matryer/moq
     3  
     4  package repository
     5  
     6  import (
     7  	"context"
     8  	"github.com/oinume/lekcije/backend/model2"
     9  	"sync"
    10  )
    11  
    12  // Ensure, that LessonFetcherMock does implement LessonFetcher.
    13  // If this is not the case, regenerate this file with moq.
    14  var _ LessonFetcher = &LessonFetcherMock{}
    15  
    16  // LessonFetcherMock is a mock implementation of LessonFetcher.
    17  //
    18  // 	func TestSomethingThatUsesLessonFetcher(t *testing.T) {
    19  //
    20  // 		// make and configure a mocked LessonFetcher
    21  // 		mockedLessonFetcher := &LessonFetcherMock{
    22  // 			CloseFunc: func()  {
    23  // 				panic("mock out the Close method")
    24  // 			},
    25  // 			FetchFunc: func(ctx context.Context, teacherID uint) (*model2.Teacher, []*model2.Lesson, error) {
    26  // 				panic("mock out the Fetch method")
    27  // 			},
    28  // 		}
    29  //
    30  // 		// use mockedLessonFetcher in code that requires LessonFetcher
    31  // 		// and then make assertions.
    32  //
    33  // 	}
    34  type LessonFetcherMock struct {
    35  	// CloseFunc mocks the Close method.
    36  	CloseFunc func()
    37  
    38  	// FetchFunc mocks the Fetch method.
    39  	FetchFunc func(ctx context.Context, teacherID uint) (*model2.Teacher, []*model2.Lesson, error)
    40  
    41  	// calls tracks calls to the methods.
    42  	calls struct {
    43  		// Close holds details about calls to the Close method.
    44  		Close []struct {
    45  		}
    46  		// Fetch holds details about calls to the Fetch method.
    47  		Fetch []struct {
    48  			// Ctx is the ctx argument value.
    49  			Ctx context.Context
    50  			// TeacherID is the teacherID argument value.
    51  			TeacherID uint
    52  		}
    53  	}
    54  	lockClose sync.RWMutex
    55  	lockFetch sync.RWMutex
    56  }
    57  
    58  // Close calls CloseFunc.
    59  func (mock *LessonFetcherMock) Close() {
    60  	if mock.CloseFunc == nil {
    61  		panic("LessonFetcherMock.CloseFunc: method is nil but LessonFetcher.Close was just called")
    62  	}
    63  	callInfo := struct {
    64  	}{}
    65  	mock.lockClose.Lock()
    66  	mock.calls.Close = append(mock.calls.Close, callInfo)
    67  	mock.lockClose.Unlock()
    68  	mock.CloseFunc()
    69  }
    70  
    71  // CloseCalls gets all the calls that were made to Close.
    72  // Check the length with:
    73  //     len(mockedLessonFetcher.CloseCalls())
    74  func (mock *LessonFetcherMock) CloseCalls() []struct {
    75  } {
    76  	var calls []struct {
    77  	}
    78  	mock.lockClose.RLock()
    79  	calls = mock.calls.Close
    80  	mock.lockClose.RUnlock()
    81  	return calls
    82  }
    83  
    84  // Fetch calls FetchFunc.
    85  func (mock *LessonFetcherMock) Fetch(ctx context.Context, teacherID uint) (*model2.Teacher, []*model2.Lesson, error) {
    86  	if mock.FetchFunc == nil {
    87  		panic("LessonFetcherMock.FetchFunc: method is nil but LessonFetcher.Fetch was just called")
    88  	}
    89  	callInfo := struct {
    90  		Ctx       context.Context
    91  		TeacherID uint
    92  	}{
    93  		Ctx:       ctx,
    94  		TeacherID: teacherID,
    95  	}
    96  	mock.lockFetch.Lock()
    97  	mock.calls.Fetch = append(mock.calls.Fetch, callInfo)
    98  	mock.lockFetch.Unlock()
    99  	return mock.FetchFunc(ctx, teacherID)
   100  }
   101  
   102  // FetchCalls gets all the calls that were made to Fetch.
   103  // Check the length with:
   104  //     len(mockedLessonFetcher.FetchCalls())
   105  func (mock *LessonFetcherMock) FetchCalls() []struct {
   106  	Ctx       context.Context
   107  	TeacherID uint
   108  } {
   109  	var calls []struct {
   110  		Ctx       context.Context
   111  		TeacherID uint
   112  	}
   113  	mock.lockFetch.RLock()
   114  	calls = mock.calls.Fetch
   115  	mock.lockFetch.RUnlock()
   116  	return calls
   117  }