func Test_HandleMessage_Should_Return_Error_when_No_ToWork(t *testing.T) {
	// given
	c := make(chan message.ToWork, 5)
	defer close(c)
	h := messaging.NewHandler(c)
	var messId [16]byte
	// when
	err := h.HandleMessage(nsq.NewMessage(messId, make([]byte, 256)))
	// then
	assert.NotNil(t, err)
}
func Test_HandleMessage_Should_Emit_ToWork(t *testing.T) {
	// given
	c := make(chan message.ToWork, 5)
	defer close(c)
	h := messaging.NewHandler(c)
	var messId [16]byte
	mess := message.ToWork{int64(1), message.TEST, "myPkg", "go1.6", "https://github.com/vil-coyote-acme/toto-example.git"}
	body, _ := json.Marshal(mess)
	// when
	err := h.HandleMessage(nsq.NewMessage(messId, body))
	// then
	assert.Nil(t, err)
	assert.Equal(t, mess, <-c)
}
func Test_HandleMessage_Should_Return_Error_when_Buffer_full(t *testing.T) {
	// given
	c := make(chan message.ToWork, 2)
	defer close(c)
	h := messaging.NewHandler(c)
	var messId [16]byte
	mess := message.ToWork{int64(3), message.TEST, "myPkg3", "go1.6", "https://github.com/vil-coyote-acme/toto-example.git"}
	body, _ := json.Marshal(mess)
	// and
	c <- message.ToWork{int64(1), message.TEST, "myPkg1", "go1.6", "https://github.com/vil-coyote-acme/toto-example.git"}
	c <- message.ToWork{int64(2), message.TEST, "myPkg2", "go1.6", "https://github.com/vil-coyote-acme/toto-example.git"}
	// when
	err := h.HandleMessage(nsq.NewMessage(messId, body))
	// then
	assert.NotNil(t, err)
	assert.Equal(t, "the buffer is full", err.Error())
}