@Inject
 public IndicesQueriesRegistry(
     Settings settings,
     Set<QueryParser> injectedQueryParsers,
     NamedWriteableRegistry namedWriteableRegistry) {
   super(settings);
   Map<String, QueryParser<?>> queryParsers = new HashMap<>();
   for (@SuppressWarnings("unchecked")
   QueryParser<? extends QueryBuilder> queryParser : injectedQueryParsers) {
     for (String name : queryParser.names()) {
       queryParsers.put(name, queryParser);
     }
     @SuppressWarnings("unchecked")
     NamedWriteable<? extends QueryBuilder> qb = queryParser.getBuilderPrototype();
     namedWriteableRegistry.registerPrototype(QueryBuilder.class, qb);
   }
   // EmptyQueryBuilder is not registered as query parser but used internally.
   // We need to register it with the NamedWriteableRegistry in order to serialize it
   namedWriteableRegistry.registerPrototype(QueryBuilder.class, EmptyQueryBuilder.PROTOTYPE);
   this.queryParsers = unmodifiableMap(queryParsers);
 }
 /** Setup for the whole base test class. */
 @BeforeClass
 public static void init() {
   NamedWriteableRegistry nwRegistry = new NamedWriteableRegistry();
   nwRegistry.registerPrototype(SuggestionBuilder.class, TermSuggestionBuilder.PROTOTYPE);
   nwRegistry.registerPrototype(SuggestionBuilder.class, PhraseSuggestionBuilder.PROTOTYPE);
   nwRegistry.registerPrototype(SuggestionBuilder.class, CompletionSuggestionBuilder.PROTOTYPE);
   nwRegistry.registerPrototype(SmoothingModel.class, Laplace.PROTOTYPE);
   nwRegistry.registerPrototype(SmoothingModel.class, LinearInterpolation.PROTOTYPE);
   nwRegistry.registerPrototype(SmoothingModel.class, StupidBackoff.PROTOTYPE);
   namedWriteableRegistry = nwRegistry;
 }