@Override
    public Graph<Entity> resolveForInstallation(Entity entity,
                                                Map<String, ValueReference> parameters,
                                                Map<EntityDescriptor, Entity> entities) {
        if (entity instanceof EntityV1) {
            return resolveForInstallationV1((EntityV1) entity, parameters, entities);
        } else {
            throw new IllegalArgumentException("Unsupported entity version: " + entity.getClass());
        }
    }
@Test
    @MongoDBFixtures("InputFacadeTest.json")
    public void resolveForInstallationLookupTable() throws NotFoundException {
        when(lookupuptableBuilder.lookupTable("whois")).thenReturn(lookupuptableBuilder);
        when(lookupuptableBuilder.lookupTable("tor-exit-node-list")).thenReturn(lookupuptableBuilder);
        when(lookupuptableBuilder.build()).thenReturn(lookupTable);
        when(lookupTableService.newBuilder()).thenReturn(lookupuptableBuilder);
        when(lookupTableService.hasTable("whois")).thenReturn(true);
        when(lookupTableService.hasTable("tor-exit-node-list")).thenReturn(true);
        final Input input = inputService.find("5ae2eb0a3d27464477f0fd8b");
        final Map<String, Object> lookupTableConfig = new HashedMap(1);
        lookupTableConfig.put("lookup_table_name", "tor-exit-node-list");
        final ConverterEntity converterEntity = ConverterEntity.create(
                ValueReference.of(Converter.Type.LOOKUP_TABLE.name()), ReferenceMapUtils.toReferenceMap(lookupTableConfig));
        final List<ConverterEntity> converterEntities = new ArrayList<>(1);
        converterEntities.add(converterEntity);
        final InputWithExtractors inputWithExtractors = InputWithExtractors.create(input, inputService.getExtractors(input));
        final LookupTableExtractor extractor = (LookupTableExtractor) inputWithExtractors.extractors().iterator().next();
        final ExtractorEntity extractorEntity = ExtractorEntity.create(
                ValueReference.of(extractor.getTitle()),
                ValueReference.of(extractor.getType()),
                ValueReference.of(extractor.getCursorStrategy()),
                ValueReference.of(extractor.getTargetField()),
                ValueReference.of(extractor.getSourceField()),
                ReferenceMapUtils.toReferenceMap(extractor.getExtractorConfig()),
                converterEntities,
                ValueReference.of(extractor.getConditionType()),
                ValueReference.of(extractor.getConditionValue()),
                ValueReference.of(extractor.getOrder())
        );
        List<ExtractorEntity> extractors = new ArrayList<>();
        extractors.add(extractorEntity);
        InputEntity inputEntity = InputEntity.create(
                ValueReference.of(input.getTitle()),
                ReferenceMapUtils.toReferenceMap(input.getConfiguration()),
                Collections.emptyMap(),
                ValueReference.of(input.getType()),
                ValueReference.of(input.isGlobal()),
                extractors);
        final Entity entity = EntityV1.builder()
                .id(ModelId.of(input.getId()))
                .type(ModelTypes.INPUT_V1)
                .data(objectMapper.convertValue(inputEntity, JsonNode.class))
                .build();
        final LookupTableEntity whoIsEntity = LookupTableEntity.create(
                ValueReference.of(DefaultEntityScope.NAME),
                ValueReference.of("whois"),
                ValueReference.of("title"),
                ValueReference.of("description"),
                ValueReference.of("cache_name"),
                ValueReference.of("dataadapter_name"),
                ValueReference.of("default_single_value"),
                ValueReference.of("BOOLEAN"),
                ValueReference.of("default_multi_value"),
                ValueReference.of("BOOLEAN")
        );

        final LookupTableEntity torNodeEntity = LookupTableEntity.create(
                ValueReference.of(DefaultEntityScope.NAME),
                ValueReference.of("tor-exit-node-list"),
                ValueReference.of("title"),
                ValueReference.of("description"),
                ValueReference.of("cache_name"),
                ValueReference.of("dataadapter_name"),
                ValueReference.of("default_single_value"),
                ValueReference.of("BOOLEAN"),
                ValueReference.of("default_multi_value"),
                ValueReference.of("BOOLEAN")
        );
        final Entity expectedWhoIsEntity = EntityV1.builder()
                .id(ModelId.of("dead-beef"))
                .data(objectMapper.convertValue(whoIsEntity, JsonNode.class))
                .type(ModelTypes.LOOKUP_TABLE_V1)
                .build();

        final Entity expectedTorEntity = EntityV1.builder()
                .id(ModelId.of("dead-feed"))
                .data(objectMapper.convertValue(torNodeEntity, JsonNode.class))
                .type(ModelTypes.LOOKUP_TABLE_V1)
                .build();
        final EntityDescriptor whoisDescriptor = expectedWhoIsEntity.toEntityDescriptor();
        final EntityDescriptor torDescriptor = expectedTorEntity.toEntityDescriptor();
        final Map<EntityDescriptor, Entity> entityDescriptorEntityMap = new HashMap<>(2);
        entityDescriptorEntityMap.put(whoisDescriptor, expectedWhoIsEntity);
        entityDescriptorEntityMap.put(torDescriptor, expectedTorEntity);
        Graph<Entity> graph = facade.resolveForInstallation(entity, Collections.emptyMap(), entityDescriptorEntityMap);
        assertThat(graph.nodes()).contains(expectedWhoIsEntity);
        assertThat(graph.nodes()).contains(expectedTorEntity);
    }