AbstractConfigurationModel implements ConfigurationModel { @Override public Parser getParser() { ensureUpToDate(); return parser; } AbstractConfigurationModel(); @Override void setUpdatedFlag(); @Override Charset getCharset(); @Override Parser getParser(); @Override List<Tokenizer> getTokenizers(); abstract Parser doGetParser(); abstract List<Tokenizer> doGetTokenizers();  }
@Test public void getParser_should_return_parser_instance() { MyConfigurationModel model = new MyConfigurationModel(); Parser<? extends Grammar> p = mock(Parser.class); model.setParser(p); assertThat(model.getParser()).isEqualTo(p); }
@Test public void getParser_should_return_same_parser_instance_when_flag_not_set() { MyConfigurationModel model = new MyConfigurationModel(); Parser<? extends Grammar> p = mock(Parser.class); model.setParser(p); assertThat(model.getParser()).isEqualTo(p); Parser<? extends Grammar> p2 = mock(Parser.class); model.setParser(p2); assertThat(model.getParser()).isEqualTo(p); }