Fix NamespaceChecker

Fix edge cases in namespace checker and provide test cases.

Change-Id: I3eeaec158f5a91bd6dadadc833f92b15a0dbe41e
Merge "Fix NamespaceChecker"