### Question:
CaliperConfigLoader { public CaliperConfig loadOrCreate() throws InvalidConfigurationException { File configFile = options.caliperConfigFile(); ImmutableMap<String, String> defaults; try { defaults = Util.loadProperties( Util.resourceSupplier(CaliperConfig.class, "global-config.properties")); } catch (IOException impossible) { throw new AssertionError(impossible); } if (configFile.exists()) { try { ImmutableMap<String, String> user = Util.loadProperties(Files.asByteSource(configFile)); return new CaliperConfig(mergeProperties(options.configProperties(), user, defaults)); } catch (IOException keepGoing) { } } ByteSource supplier = Util.resourceSupplier(CaliperConfig.class, "default-config.properties"); tryCopyIfNeeded(supplier, configFile); ImmutableMap<String, String> user; try { user = Util.loadProperties(supplier); } catch (IOException e) { throw new AssertionError(e); } return new CaliperConfig(mergeProperties(options.configProperties(), user, defaults)); } @Inject  CaliperConfigLoader(CaliperOptions options); CaliperConfig loadOrCreate();  }### Answer:
@Test public void loadOrCreate_configFileExistsNoOverride() throws Exception { when(optionsMock.caliperConfigFile()).thenReturn(tempConfigFile); when(optionsMock.configProperties()).thenReturn(ImmutableMap.<String, String>of()); CaliperConfigLoader loader = new CaliperConfigLoader(optionsMock); CaliperConfig config = loader.loadOrCreate(); assertEquals("franklin", config.properties.get("some.property")); }
@Test public void loadOrCreate_configFileExistsWithOverride() throws Exception { when(optionsMock.caliperConfigFile()).thenReturn(tempConfigFile); when(optionsMock.configProperties()).thenReturn(ImmutableMap.of( "some.property", "tacos")); CaliperConfigLoader loader = new CaliperConfigLoader(optionsMock); CaliperConfig config = loader.loadOrCreate(); assertEquals("tacos", config.properties.get("some.property")); }