### Question:
NSBarcodeConfig { public boolean hasApiConfig(){ try { return config.has(NSBarcodeConfigKeys.API_CONFIG) && config.getJSONObject(NSBarcodeConfigKeys.API_CONFIG) .getJSONArray(NSBarcodeConfigKeys.API_URI).length() > 0; } 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 testApiNotEnabledWithMongoConfig() { setValidMongoOnlyNoCollections(); assertThat(barcode.hasApiConfig(), is(false)); }
@Test public void testApiEnabledWithApiConfig() { setSingleValidApiOnly(); assertThat(barcode.hasApiConfig(), is(true)); }
@Test public void testSingleApiUriAndMongoEnablesApiWithApiAndMongoConfig() { setSingleValidApiAndMongo(); assertThat(barcode.hasApiConfig(), is(true)); }
@Test public void testMultipleValidApiUriEnablesApiWithApiConfig() { setMultipleValidApiOnly(); assertThat(barcode.hasApiConfig(), is(true)); }
@Test public void testEmptyValidApiDoesNotEnableApiWithApiConfig() { setEmptyValidApiOnly(); assertThat(barcode.hasApiConfig(), is(false)); }
@Test public void testEmptyValidMongoDoesNotEnableApiWithApiConfig() { setEmptyValidMongoOnly(); assertThat(barcode.hasApiConfig(), is(false)); }
@Test public void testInvalidConfigWithValidJsonDoesNotEnableApi() { setInvalidConfigWithValidJson(); assertThat(barcode.hasApiConfig(), is(false)); }
@Test public void testInvalidJsonDoesNotEnableApi() { setInvalidJson(); assertThat(barcode.hasApiConfig(), is(false)); }