user

package
v0.0.0-...-e0c9873 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 7, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package user is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockRepository

type MockRepository struct {
	// contains filtered or unexported fields
}

MockRepository is a mock of Repository interface.

func NewMockRepository

func NewMockRepository(ctrl *gomock.Controller) *MockRepository

NewMockRepository creates a new mock instance.

func (*MockRepository) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockRepository) Get

func (m *MockRepository) Get(ctx context.Context, id uuid.UUID) (User, error)

Get mocks base method.

func (*MockRepository) Save

func (m *MockRepository) Save(ctx context.Context, user User) error

Save mocks base method.

type MockRepositoryMockRecorder

type MockRepositoryMockRecorder struct {
	// contains filtered or unexported fields
}

MockRepositoryMockRecorder is the mock recorder for MockRepository.

func (*MockRepositoryMockRecorder) Get

func (mr *MockRepositoryMockRecorder) Get(ctx, id interface{}) *gomock.Call

Get indicates an expected call of Get.

func (*MockRepositoryMockRecorder) Save

func (mr *MockRepositoryMockRecorder) Save(ctx, user interface{}) *gomock.Call

Save indicates an expected call of Save.

type Name

type Name struct {
	// contains filtered or unexported fields
}

func NewName

func NewName(first, last string) (Name, error)

func (Name) FullName

func (n Name) FullName() string

func (Name) String

func (n Name) String() string

type Repository

type Repository interface {
	Get(ctx context.Context, id uuid.UUID) (User, error)
	Save(ctx context.Context, user User) error
}

type RepositoryMock

type RepositoryMock struct {
	// GetFunc mocks the Get method.
	GetFunc func(ctx context.Context, id uuid.UUID) (User, error)

	// SaveFunc mocks the Save method.
	SaveFunc func(ctx context.Context, user User) error
	// contains filtered or unexported fields
}

RepositoryMock is a mock implementation of Repository.

func TestSomethingThatUsesRepository(t *testing.T) {

	// make and configure a mocked Repository
	mockedRepository := &RepositoryMock{
		GetFunc: func(ctx context.Context, id uuid.UUID) (User, error) {
			panic("mock out the Get method")
		},
		SaveFunc: func(ctx context.Context, user User) error {
			panic("mock out the Save method")
		},
	}

	// use mockedRepository in code that requires Repository
	// and then make assertions.

}

func (*RepositoryMock) Get

func (mock *RepositoryMock) Get(ctx context.Context, id uuid.UUID) (User, error)

Get calls GetFunc.

func (*RepositoryMock) GetCalls

func (mock *RepositoryMock) GetCalls() []struct {
	Ctx context.Context
	ID  uuid.UUID
}

GetCalls gets all the calls that were made to Get. Check the length with:

len(mockedRepository.GetCalls())

func (*RepositoryMock) Save

func (mock *RepositoryMock) Save(ctx context.Context, user User) error

Save calls SaveFunc.

func (*RepositoryMock) SaveCalls

func (mock *RepositoryMock) SaveCalls() []struct {
	Ctx  context.Context
	User User
}

SaveCalls gets all the calls that were made to Save. Check the length with:

len(mockedRepository.SaveCalls())

type User

type User struct {
	// contains filtered or unexported fields
}

func NewUser

func NewUser(name Name, birthday types.Date) User

func NewUserWithID

func NewUserWithID(id uuid.UUID, name Name, birthday types.Date) User

func (User) Birthday

func (u User) Birthday() types.Date

func (User) ID

func (u User) ID() uuid.UUID

func (User) Name

func (u User) Name() Name

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL