leave_group_response_test.go 696 B

123456789101112131415161718192021222324
  1. package sarama
  2. import "testing"
  3. var (
  4. leaveGroupResponseNoError = []byte{0x00, 0x00}
  5. leaveGroupResponseWithError = []byte{0, 25}
  6. )
  7. func TestLeaveGroupResponse(t *testing.T) {
  8. var response *LeaveGroupResponse
  9. response = new(LeaveGroupResponse)
  10. testVersionDecodable(t, "no error", response, leaveGroupResponseNoError, 0)
  11. if response.Err != ErrNoError {
  12. t.Error("Decoding error failed: no error expected but found", response.Err)
  13. }
  14. response = new(LeaveGroupResponse)
  15. testVersionDecodable(t, "with error", response, leaveGroupResponseWithError, 0)
  16. if response.Err != ErrUnknownMemberId {
  17. t.Error("Decoding error failed: ErrUnknownMemberId expected but found", response.Err)
  18. }
  19. }