ConfigUtil: Allow default null values for string attributes
AccountGeneralPreferences has downloadScheme attribute that has default value null, so we need to support it. Change-Id: I1b43c517f2742b5b56526b3911dd9fb8217f2509
This commit is contained in:
committed by
David Pursehouse
parent
7523c33cd6
commit
a8ba8665a5
@@ -47,6 +47,7 @@ public class ConfigUtilTest {
|
||||
public Boolean bd;
|
||||
public String s;
|
||||
public String sd;
|
||||
public String nd;
|
||||
public Theme t;
|
||||
public Theme td;
|
||||
static SectionInfo defaults() {
|
||||
@@ -62,6 +63,9 @@ public class ConfigUtilTest {
|
||||
i.bd = true;
|
||||
i.s = "foo";
|
||||
i.sd = "bar";
|
||||
// This line is not needed, as it's null per default.
|
||||
// Put it here to be explicit.
|
||||
i.nd = null;
|
||||
i.t = Theme.DEFAULT;
|
||||
i.td = Theme.DEFAULT;
|
||||
return i;
|
||||
@@ -96,6 +100,7 @@ public class ConfigUtilTest {
|
||||
assertThat(cfg.getLong(SECT, SUB, "ll", 0L)).isEqualTo(in.ll);
|
||||
assertThat(cfg.getString(SECT, SUB, "s")).isEqualTo(in.s);
|
||||
assertThat(cfg.getString(SECT, SUB, "sd")).isNull();
|
||||
assertThat(cfg.getString(SECT, SUB, "nd")).isNull();
|
||||
|
||||
SectionInfo out = new SectionInfo();
|
||||
ConfigUtil.loadSection(cfg, SECT, SUB, out, d, null);
|
||||
@@ -110,6 +115,7 @@ public class ConfigUtilTest {
|
||||
assertThat(out.bd).isNull();
|
||||
assertThat(out.s).isEqualTo(in.s);
|
||||
assertThat(out.sd).isEqualTo(d.sd);
|
||||
assertThat(out.nd).isNull();
|
||||
assertThat(out.t).isEqualTo(in.t);
|
||||
assertThat(out.td).isEqualTo(d.td);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user