### Question:
PermissionExtractorRegistry { public PermissionExtractor getPermissionExtractor(PlatformMessage message) { PermissionExtractor extractor = extractors.get(message.getMessageType()); return extractor == null ? fallbackExtractor : extractor; } @Inject  PermissionExtractorRegistry(Map<String,PermissionExtractor> extractors); PermissionExtractor getPermissionExtractor(PlatformMessage message);  }### Answer:
@Test public void testDeviceCommand() { PermissionExtractor extractor = registry.getPermissionExtractor(AuthzFixtures.createSwitchOn(UUID.randomUUID())); assertTrue(extractor instanceof DefaultPermissionExtractor); }
@Test public void testGetAttributes() { PermissionExtractor extractor = registry.getPermissionExtractor(AuthzFixtures.createGetAttributes(UUID.randomUUID(), "dev:name")); assertTrue(extractor instanceof GetAttributesPermissionExtractor); }
@Test public void testSetAttributes() { Map<String,Object> attributes = new HashMap<>(); attributes.put("dev:name", "foobar"); PermissionExtractor extractor = registry.getPermissionExtractor(AuthzFixtures.createSetAttributes(UUID.randomUUID(), attributes)); assertTrue(extractor instanceof SetAttributesPermissionExtractor); }