### Question:
PositionFilterFactory implements TokenFilterFactory { public TokenFilter createTokenFilter(TokenStream tokenStream, Properties properties) throws IOException { String positionAttribute = properties.getProperty(POSITION_PARAMETER); Integer position = -1; if( positionAttribute == null ) throw new IllegalArgumentException("no position information provided"); if( positionAttribute.equals(FIRST_POSITION_PARAMETER_VALUE) ) position = PositionFilter.FIRST_POSITION; else if( positionAttribute.equals(LAST_POSITION_PARAMETER_VALUE) ) position = PositionFilter.LAST_POSITION; else throw new IllegalArgumentException("unknown position value: " + positionAttribute); return new PositionFilter(tokenStream, position); }  TokenFilter createTokenFilter(TokenStream tokenStream, Properties properties); void preloadResources(Properties properties); static final String POSITION_PARAMETER; static final String FIRST_POSITION_PARAMETER_VALUE; static final String LAST_POSITION_PARAMETER_VALUE; }### Answer:
@Test public void testCreateTokenFilter() throws IOException{ Properties properties = new Properties(); properties.setProperty(PositionFilterFactory.POSITION_PARAMETER, PositionFilterFactory.FIRST_POSITION_PARAMETER_VALUE); PositionFilter positionTokenFilter = (PositionFilter) positionFilterFactory.createTokenFilter(tokenStream, properties); assertEquals(PositionFilter.FIRST_POSITION, positionTokenFilter.getPosition()); properties = new Properties(); properties.setProperty(PositionFilterFactory.POSITION_PARAMETER, PositionFilterFactory.LAST_POSITION_PARAMETER_VALUE); positionTokenFilter = (PositionFilter) positionFilterFactory.createTokenFilter(tokenStream, properties); assertEquals(PositionFilter.LAST_POSITION, positionTokenFilter.getPosition()); }