The testforblock command can test the block without NBT tag like "/testforblock ~ ~1 ~ minecraft:hopper" will return true by comparator. However, when you add any NBT tags like "/testforblock ~ ~1 ~ minecraft:hopper -1 {Items:[
{Slot:0,id:bed,Count:1}]}" it nolonger work any more.
This issue seems effect other commands like testfor .etc. NBT tag can be applied when setblock or summon something but can not be detected correctly.