### Question:
ConfigManager { List<FillOption> getOptions() { final List<FillOption> savedOptions = readConfigsFromStore(); final List<FillOption> result = new ArrayList<>(fillConfig.getOptions().size() + savedOptions.size()); result.addAll(savedOptions); result.addAll(fillConfig.getOptions()); return result; } ConfigManager(FillConfig fillConfig, Store store);   }### Answer:
@Test public void getOptions_returns_all_options() throws Exception { when(store.read(eq(ConfigManager.ORDER))).thenReturn(Collections.singletonList("n1")); when(store.read(eq(ConfigManager.KEY_PREFIX + "n1"))).thenReturn(Arrays.asList("v1", "v2")); final List<FillOption> expected = new ArrayList<>(); expected.add(new FillOption("n1", Arrays.asList("v1", "v2"))); expected.addAll(simpleOptions("opt1", "opt2")); assertEquals(expected, configManager.getOptions()); }
@Test public void getOptions_not_include_options_with_bad_size() throws Exception { when(store.read(eq(ConfigManager.ORDER))).thenReturn(Arrays.asList("n1", "n2")); when(store.read(eq(ConfigManager.KEY_PREFIX + "n1"))).thenReturn(Collections.singletonList("v1")); when(store.read(eq(ConfigManager.KEY_PREFIX + "n1"))).thenReturn(Arrays.asList("v1", "v2", "v3")); assertEquals(simpleOptions("opt1", "opt2"), configManager.getOptions()); }
@Test public void getOptions_with_empty_custom_options_returns_options_from_config_only() throws Exception { when(store.read(eq(ConfigManager.ORDER))).thenReturn(Collections.emptyList()); assertEquals(simpleOptions("opt1", "opt2"), configManager.getOptions()); verify(store, times(1)).read(anyString()); }