@Test public void asBoolean_isStaticValue_returnsStaticBoolean() throws Exception { FirebaseRemoteConfigValue value = new FirebaseRemoteConfigValueImpl( Boolean.toString(DEFAULT_VALUE_FOR_BOOLEAN), VALUE_SOURCE_STATIC); assertThat(value.asBoolean()).isEqualTo(DEFAULT_VALUE_FOR_BOOLEAN); }
@Override public boolean asBoolean() throws IllegalArgumentException { if (source == FirebaseRemoteConfig.VALUE_SOURCE_STATIC) { return FirebaseRemoteConfig.DEFAULT_VALUE_FOR_BOOLEAN; } String valueAsString = asTrimmedString(); if (TRUE_REGEX.matcher(valueAsString).matches()) { return true; } else if (FALSE_REGEX.matcher(valueAsString).matches()) { return false; } throw new IllegalArgumentException( String.format(ILLEGAL_ARGUMENT_STRING_FORMAT, valueAsString, "boolean")); }
FirebaseRemoteConfigValueImpl implements FirebaseRemoteConfigValue { @Override public boolean asBoolean() throws IllegalArgumentException { if (source == FirebaseRemoteConfig.VALUE_SOURCE_STATIC) { return FirebaseRemoteConfig.DEFAULT_VALUE_FOR_BOOLEAN; } String valueAsString = asTrimmedString(); if (TRUE_REGEX.matcher(valueAsString).matches()) { return true; } else if (FALSE_REGEX.matcher(valueAsString).matches()) { return false; } throw new IllegalArgumentException( String.format(ILLEGAL_ARGUMENT_STRING_FORMAT, valueAsString, "boolean")); } }
FirebaseRemoteConfigValueImpl implements FirebaseRemoteConfigValue { @Override public boolean asBoolean() throws IllegalArgumentException { if (source == FirebaseRemoteConfig.VALUE_SOURCE_STATIC) { return FirebaseRemoteConfig.DEFAULT_VALUE_FOR_BOOLEAN; } String valueAsString = asTrimmedString(); if (TRUE_REGEX.matcher(valueAsString).matches()) { return true; } else if (FALSE_REGEX.matcher(valueAsString).matches()) { return false; } throw new IllegalArgumentException( String.format(ILLEGAL_ARGUMENT_STRING_FORMAT, valueAsString, "boolean")); } FirebaseRemoteConfigValueImpl(String value, int source); }
FirebaseRemoteConfigValueImpl implements FirebaseRemoteConfigValue { @Override public boolean asBoolean() throws IllegalArgumentException { if (source == FirebaseRemoteConfig.VALUE_SOURCE_STATIC) { return FirebaseRemoteConfig.DEFAULT_VALUE_FOR_BOOLEAN; } String valueAsString = asTrimmedString(); if (TRUE_REGEX.matcher(valueAsString).matches()) { return true; } else if (FALSE_REGEX.matcher(valueAsString).matches()) { return false; } throw new IllegalArgumentException( String.format(ILLEGAL_ARGUMENT_STRING_FORMAT, valueAsString, "boolean")); } FirebaseRemoteConfigValueImpl(String value, int source); @Override long asLong(); @Override double asDouble(); @Override String asString(); @Override byte[] asByteArray(); @Override boolean asBoolean(); @Override int getSource(); }
FirebaseRemoteConfigValueImpl implements FirebaseRemoteConfigValue { @Override public boolean asBoolean() throws IllegalArgumentException { if (source == FirebaseRemoteConfig.VALUE_SOURCE_STATIC) { return FirebaseRemoteConfig.DEFAULT_VALUE_FOR_BOOLEAN; } String valueAsString = asTrimmedString(); if (TRUE_REGEX.matcher(valueAsString).matches()) { return true; } else if (FALSE_REGEX.matcher(valueAsString).matches()) { return false; } throw new IllegalArgumentException( String.format(ILLEGAL_ARGUMENT_STRING_FORMAT, valueAsString, "boolean")); } FirebaseRemoteConfigValueImpl(String value, int source); @Override long asLong(); @Override double asDouble(); @Override String asString(); @Override byte[] asByteArray(); @Override boolean asBoolean(); @Override int getSource();  }