@Test public void use_default_compiler_if_none_registered() { PatternCompilerProvider.findPatternCompiler(Collections.emptyIterator()); assertSame(DefaultPatternCompiler.class, PatternCompilerProvider.service.getClass()); }
static void findPatternCompiler(Iterator<PatternCompiler> iterator) { if (iterator.hasNext()) { service = iterator.next(); if (iterator.hasNext()) { throwMoreThanOneCompilerException(iterator); } } else { service = new DefaultPatternCompiler(); } }
PatternCompilerProvider { static void findPatternCompiler(Iterator<PatternCompiler> iterator) { if (iterator.hasNext()) { service = iterator.next(); if (iterator.hasNext()) { throwMoreThanOneCompilerException(iterator); } } else { service = new DefaultPatternCompiler(); } } }
PatternCompilerProvider { static void findPatternCompiler(Iterator<PatternCompiler> iterator) { if (iterator.hasNext()) { service = iterator.next(); if (iterator.hasNext()) { throwMoreThanOneCompilerException(iterator); } } else { service = new DefaultPatternCompiler(); } } private  PatternCompilerProvider(); }
PatternCompilerProvider { static void findPatternCompiler(Iterator<PatternCompiler> iterator) { if (iterator.hasNext()) { service = iterator.next(); if (iterator.hasNext()) { throwMoreThanOneCompilerException(iterator); } } else { service = new DefaultPatternCompiler(); } } private  PatternCompilerProvider();  }
PatternCompilerProvider { static void findPatternCompiler(Iterator<PatternCompiler> iterator) { if (iterator.hasNext()) { service = iterator.next(); if (iterator.hasNext()) { throwMoreThanOneCompilerException(iterator); } } else { service = new DefaultPatternCompiler(); } } private  PatternCompilerProvider();   }