### Question:
NSBarcodeConfig { public boolean hasMongoConfig(){ try { return config.has(NSBarcodeConfigKeys.MONGO_CONFIG) && config.getJSONObject(NSBarcodeConfigKeys.MONGO_CONFIG).has(NSBarcodeConfigKeys.MONGO_URI); } catch (JSONException e) { return false; } } NSBarcodeConfig(String decodeResults); void configureBarcode(String jsonConfig); Optional<String> getMongoUri(); List<String> getApiUris(); Optional<String> getMongoCollection(); Optional<String> getMongoDeviceStatusCollection(); boolean hasMongoConfig(); boolean hasApiConfig();  }### Answer:
@Test public void testMongoEnabledWithMongoConfig() { setValidMongoOnlyNoCollections(); assertThat(barcode.hasMongoConfig(), is(true)); }
@Test public void testMongoIsNotEnabledWithApiConfig() { setSingleValidApiOnly(); assertThat(barcode.hasMongoConfig(), is(false)); }
@Test public void testSingleApiUriAndMongoEnablesMongoWithApiAndMongoConfig() { setSingleValidApiAndMongo(); assertThat(barcode.hasMongoConfig(), is(true)); }
@Test public void testMultipleValidApiUriDoesNotEnableMongoWithApiConfig() { setMultipleValidApiOnly(); assertThat(barcode.hasMongoConfig(), is(false)); }
@Test public void testEmptyValidApiDoesNotEnableMongoWithApiConfig() { setEmptyValidApiOnly(); assertThat(barcode.hasMongoConfig(), is(false)); }
@Test public void testEmptyValidMongoDoesNotEnableMongoWithApiConfig() { setEmptyValidMongoOnly(); assertThat(barcode.hasMongoConfig(), is(false)); }
@Test public void testInvalidConfigWithValidJsonDoesNotEnableMongo() { setInvalidConfigWithValidJson(); assertThat(barcode.hasMongoConfig(), is(false)); }
@Test public void testInvalidJsonDoesNotEnableMongo() { setInvalidJson(); assertThat(barcode.hasMongoConfig(), is(false)); }