/** TDD. */ @Test(expected = IllegalArgumentException.class) public void existKOEmpty() { // Given testedStore.existProperty(""); // Then // then expect to fail }
/** {@inheritDoc} */ @Override public List<Object> getList(String key, List<?> defaultValue) { if (ff4jStore().existProperty(key)) return getList(key); return new ArrayList<Object>(defaultValue); }
/** {@inheritDoc} */ @Override public Double getDouble(String key, Double defaultValue) { return ff4jStore().existProperty(key) ? getDouble(key) : defaultValue; }
/** {@inheritDoc} */ @Override public Float getFloat(String key, Float defaultValue) { return ff4jStore().existProperty(key) ? getFloat(key) : defaultValue; }
/** {@inheritDoc} */ @Override public int getInt(String key, int defaultValue) { return ff4jStore().existProperty(key) ? getInt(key) : defaultValue; }
/** {@inheritDoc} */ @Override public short getShort(String key, short defaultValue) { return ff4jStore().existProperty(key) ? getShort(key) : defaultValue; }
/** {@inheritDoc} */ @Override public Short getShort(String key, Short defaultValue) { return ff4jStore().existProperty(key) ? getShort(key) : defaultValue; }
/** {@inheritDoc} */ @Override public BigInteger getBigInteger(String key, BigInteger defaultValue) { return ff4jStore().existProperty(key) ? getBigInteger(key) : defaultValue; }
public void assertPropertyExist(String propertyName) { if (!ff4j.getPropertiesStore().existProperty(propertyName)) { throw new PropertyNotFoundException(); } }
/** {@inheritDoc} */ @Override public Boolean getBoolean(String key, Boolean defaultValue) { return ff4jStore().existProperty(key) ? getBoolean(key) : defaultValue; }
/** {@inheritDoc} */ @Override public float getFloat(String key, float defaultValue) { return ff4jStore().existProperty(key) ? getFloat(key) : defaultValue; }
/** {@inheritDoc} */ @Override public long getLong(String key, long defaultValue) { return ff4jStore().existProperty(key) ? getLong(key) : defaultValue; }
/** {@inheritDoc} */ @Override public String getString(String key, String defaultValue) { return ff4jStore().existProperty(key) ? getString(key) : defaultValue; }
/** TDD. */ @Test public void existfalse() { // When-Then Assert.assertFalse(testedStore.existProperty("propertyThatNotExist")); }
/** TDD. */ @Test public void addPropertyOKsimple() { // Given Assert.assertFalse(testedStore.existProperty(ADD_PROPERTY_O_KSIMPLE)); // When testedStore.createProperty(new PropertyString(ADD_PROPERTY_O_KSIMPLE, "ff4j")); // Then Assert.assertTrue(testedStore.existProperty(ADD_PROPERTY_O_KSIMPLE)); }
/** TDD. */ @Test public void addPropertyOKDate() { // Given //Assert.assertFalse(testedStore.exist("log")); // When testedStore.createProperty(new PropertyDate("ddate", new Date())); // Then Assert.assertTrue(testedStore.existProperty("ddate")); }
/** TDD. */ @Test(expected = PropertyNotFoundException.class) public void deleteKOdoesnotexist() { // Given Assert.assertFalse(testedStore.existProperty(INVALID)); // When testedStore.deleteProperty(INVALID); }
/** {@inheritDoc} */ @Override public boolean existProperty(String propertyName) { // not in cache but maybe created from last access if (getCacheManager().getProperty(propertyName) == null) { return getTargetPropertyStore().existProperty(propertyName); } return true; }
/** TDD. */ @Test public void addPropertyOKLogLevel() { // Given //Assert.assertFalse(testedStore.exist("log")); // When testedStore.createProperty(new PropertyLogLevel("logi", LogLevel.DEBUG)); // Then Assert.assertTrue(testedStore.existProperty("logi")); }
/** TDD. */ @Test(expected = PropertyAlreadyExistException.class) public void addPropertyKOAlreadyExist() { // Given testedStore.createProperty(new PropertyLogLevel("log", LogLevel.DEBUG)); Assert.assertTrue(testedStore.existProperty("log")); // When testedStore.createProperty(new PropertyLogLevel("log", LogLevel.DEBUG)); // Then expect to fail }