ExpressionAggregationScriptFactory implements AggregationScript.Factory { @Override public AggregationScript.LeafFactory newFactory(Map<String, Object> params, SearchLookup lookup) { return new ExpressionAggregationScriptLeafFactory(expression, params, lookup); } ExpressionAggregationScriptFactory(Expression expression); @Override boolean isResultDeterministic(); @Override AggregationScript.LeafFactory newFactory(Map<String, Object> params, SearchLookup lookup);  }
@Test void can_initialize_expression_filter_script() throws IOException { when(searchLookup.getLeafSearchLookup(leafReaderContext)).thenReturn(leafSearchLookup); AggregationScript.LeafFactory leafFactory = factory.newFactory(params, searchLookup); assertFalse(leafFactory.needs_score()); AggregationScript actualScript = leafFactory.newInstance(leafReaderContext); assertEquals( new ExpressionAggregationScript(expression, searchLookup, leafReaderContext, params), actualScript ); }