|
|
@@ -15,8 +15,6 @@ package mocks
|
|
|
|
|
|
import (
|
|
|
"errors"
|
|
|
- "fmt"
|
|
|
- "regexp"
|
|
|
|
|
|
"github.com/Shopify/sarama"
|
|
|
)
|
|
|
@@ -31,20 +29,6 @@ type ErrorReporter interface {
|
|
|
// to check the value passed.
|
|
|
type ValueChecker func(val []byte) error
|
|
|
|
|
|
-// This function is used inside the mocks unit tests to generate ValueCheckers
|
|
|
-func generateRegexpChecker(re string) func([]byte) error {
|
|
|
- return func(val []byte) error {
|
|
|
- matched, err := regexp.MatchString(re, string(val))
|
|
|
- if err != nil {
|
|
|
- return errors.New("Error while trying to match the input message with the expected pattern: " + err.Error())
|
|
|
- }
|
|
|
- if !matched {
|
|
|
- return fmt.Errorf("No match between input value \"%s\" and expected pattern \"%s\"", val, re)
|
|
|
- }
|
|
|
- return nil
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
var (
|
|
|
errProduceSuccess error = nil
|
|
|
errOutOfExpectations = errors.New("No more expectations set on mock")
|