mock

package
v0.0.0-...-9613083 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2020 License: MIT Imports: 4 Imported by: 2

Documentation

Overview

Code generated by mocker; DO NOT EDIT github.com/travisjeffery/mocker

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client for testing

func NewClient

func NewClient(msgCount int) *Client

NewClient is a client that fetches given number of msgs

func (*Client) CreateTopics

func (p *Client) CreateTopics(createRequest *protocol.CreateTopicRequests) (*protocol.CreateTopicsResponse, error)

func (*Client) Fetch

func (p *Client) Fetch(fetchRequest *protocol.FetchRequest) (*protocol.FetchResponse, error)

func (*Client) LeaderAndISR

func (p *Client) LeaderAndISR(request *protocol.LeaderAndISRRequest) (*protocol.LeaderAndISRResponse, error)

func (*Client) Messages

func (p *Client) Messages() [][]byte

type CommitLog

type CommitLog struct {
	// AppendFunc mocks the Append method.
	AppendFunc func(in1 []byte) (int64, error)

	// DeleteFunc mocks the Delete method.
	DeleteFunc func() error

	// NewReaderFunc mocks the NewReader method.
	NewReaderFunc func(offset int64, maxBytes int32) (io.Reader, error)

	// NewestOffsetFunc mocks the NewestOffset method.
	NewestOffsetFunc func() int64

	// OldestOffsetFunc mocks the OldestOffset method.
	OldestOffsetFunc func() int64

	// TruncateFunc mocks the Truncate method.
	TruncateFunc func(in1 int64) error
	// contains filtered or unexported fields
}

CommitLog is a mock implementation of CommitLog.

    func TestSomethingThatUsesCommitLog(t *testing.T) {

        // make and configure a mocked CommitLog
        mockedCommitLog := &CommitLog{
            AppendFunc: func(in1 []byte) (int64, error) {
	               panic("TODO: mock out the Append method")
            },
            DeleteFunc: func() error {
	               panic("TODO: mock out the Delete method")
            },
            NewReaderFunc: func(offset int64,maxBytes int32) (io.Reader, error) {
	               panic("TODO: mock out the NewReader method")
            },
            NewestOffsetFunc: func() int64 {
	               panic("TODO: mock out the NewestOffset method")
            },
            OldestOffsetFunc: func() int64 {
	               panic("TODO: mock out the OldestOffset method")
            },
            TruncateFunc: func(in1 int64) error {
	               panic("TODO: mock out the Truncate method")
            },
        }

        // TODO: use mockedCommitLog in code that requires CommitLog
        //       and then make assertions.

    }

func (*CommitLog) Append

func (mock *CommitLog) Append(in1 []byte) (int64, error)

Append calls AppendFunc.

func (*CommitLog) AppendCalled

func (mock *CommitLog) AppendCalled() bool

AppendCalled returns true if at least one call was made to Append.

func (*CommitLog) AppendCalls

func (mock *CommitLog) AppendCalls() []struct {
	In1 []byte
}

AppendCalls gets all the calls that were made to Append. Check the length with:

len(mockedCommitLog.AppendCalls())

func (*CommitLog) Delete

func (mock *CommitLog) Delete() error

Delete calls DeleteFunc.

func (*CommitLog) DeleteCalled

func (mock *CommitLog) DeleteCalled() bool

DeleteCalled returns true if at least one call was made to Delete.

func (*CommitLog) DeleteCalls

func (mock *CommitLog) DeleteCalls() []struct {
}

DeleteCalls gets all the calls that were made to Delete. Check the length with:

len(mockedCommitLog.DeleteCalls())

func (*CommitLog) NewReader

func (mock *CommitLog) NewReader(offset int64, maxBytes int32) (io.Reader, error)

NewReader calls NewReaderFunc.

func (*CommitLog) NewReaderCalled

func (mock *CommitLog) NewReaderCalled() bool

NewReaderCalled returns true if at least one call was made to NewReader.

func (*CommitLog) NewReaderCalls

func (mock *CommitLog) NewReaderCalls() []struct {
	Offset   int64
	MaxBytes int32
}

NewReaderCalls gets all the calls that were made to NewReader. Check the length with:

len(mockedCommitLog.NewReaderCalls())

func (*CommitLog) NewestOffset

func (mock *CommitLog) NewestOffset() int64

NewestOffset calls NewestOffsetFunc.

func (*CommitLog) NewestOffsetCalled

func (mock *CommitLog) NewestOffsetCalled() bool

NewestOffsetCalled returns true if at least one call was made to NewestOffset.

func (*CommitLog) NewestOffsetCalls

func (mock *CommitLog) NewestOffsetCalls() []struct {
}

NewestOffsetCalls gets all the calls that were made to NewestOffset. Check the length with:

len(mockedCommitLog.NewestOffsetCalls())

func (*CommitLog) OldestOffset

func (mock *CommitLog) OldestOffset() int64

OldestOffset calls OldestOffsetFunc.

func (*CommitLog) OldestOffsetCalled

func (mock *CommitLog) OldestOffsetCalled() bool

OldestOffsetCalled returns true if at least one call was made to OldestOffset.

func (*CommitLog) OldestOffsetCalls

func (mock *CommitLog) OldestOffsetCalls() []struct {
}

OldestOffsetCalls gets all the calls that were made to OldestOffset. Check the length with:

len(mockedCommitLog.OldestOffsetCalls())

func (*CommitLog) Reset

func (mock *CommitLog) Reset()

Reset resets the calls made to the mocked APIs.

func (*CommitLog) Truncate

func (mock *CommitLog) Truncate(in1 int64) error

Truncate calls TruncateFunc.

func (*CommitLog) TruncateCalled

func (mock *CommitLog) TruncateCalled() bool

TruncateCalled returns true if at least one call was made to Truncate.

func (*CommitLog) TruncateCalls

func (mock *CommitLog) TruncateCalls() []struct {
	In1 int64
}

TruncateCalls gets all the calls that were made to Truncate. Check the length with:

len(mockedCommitLog.TruncateCalls())

Jump to

Keyboard shortcuts

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