Fix a bug in message-type and add tests for it.

Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>