-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix issue #73: convert tests to blackbox tests
- Loading branch information
Showing
13 changed files
with
125 additions
and
304 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,28 @@ | ||
package classifier | ||
package classifier_test | ||
|
||
import ( | ||
"errors" | ||
"testing" | ||
|
||
"github.com/kamilsk/retry/classifier" | ||
) | ||
|
||
func TestBlacklistClassifier_Classify(t *testing.T) { | ||
var ( | ||
errInBlacklist = errors.New("is in blacklist") | ||
errNotInBlacklist = errors.New("is not in blacklist") | ||
) | ||
list := BlacklistClassifier([]error{errInBlacklist}) | ||
list := classifier.BlacklistClassifier([]error{errInBlacklist}) | ||
|
||
if list.Classify(nil) != Succeed { | ||
if list.Classify(nil) != classifier.Succeed { | ||
t.Error("succeed is expected") | ||
} | ||
|
||
if list.Classify(errNotInBlacklist) != Retry { | ||
if list.Classify(errNotInBlacklist) != classifier.Retry { | ||
t.Error("retry is expected") | ||
} | ||
|
||
if list.Classify(errInBlacklist) != Fail { | ||
if list.Classify(errInBlacklist) != classifier.Fail { | ||
t.Error("fail is expected") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,20 @@ | ||
package classifier | ||
package classifier_test | ||
|
||
import ( | ||
"errors" | ||
"testing" | ||
|
||
"github.com/kamilsk/retry/classifier" | ||
) | ||
|
||
func TestDefaultClassifier_Classify(t *testing.T) { | ||
defaultClassifier := DefaultClassifier{} | ||
defaultClassifier := classifier.DefaultClassifier{} | ||
|
||
if defaultClassifier.Classify(nil) != Succeed { | ||
if defaultClassifier.Classify(nil) != classifier.Succeed { | ||
t.Error("succeed is expected") | ||
} | ||
|
||
if defaultClassifier.Classify(errors.New("error")) != Retry { | ||
if defaultClassifier.Classify(errors.New("error")) != classifier.Retry { | ||
t.Error("retry is expected") | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,28 @@ | ||
package classifier | ||
package classifier_test | ||
|
||
import ( | ||
"errors" | ||
"testing" | ||
|
||
"github.com/kamilsk/retry/classifier" | ||
) | ||
|
||
func TestWhitelistClassifier_Classify(t *testing.T) { | ||
var ( | ||
errInWhitelist = errors.New("is in blacklist") | ||
errNotInWhitelist = errors.New("is not in blacklist") | ||
) | ||
list := WhitelistClassifier([]error{errInWhitelist}) | ||
list := classifier.WhitelistClassifier([]error{errInWhitelist}) | ||
|
||
if list.Classify(nil) != Succeed { | ||
if list.Classify(nil) != classifier.Succeed { | ||
t.Error("succeed is expected") | ||
} | ||
|
||
if list.Classify(errNotInWhitelist) != Fail { | ||
if list.Classify(errNotInWhitelist) != classifier.Fail { | ||
t.Error("fail is expected") | ||
} | ||
|
||
if list.Classify(errInWhitelist) != Retry { | ||
if list.Classify(errInWhitelist) != classifier.Retry { | ||
t.Error("retry is expected") | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.