Skip to content

Commit 14164fd

Browse files
IgorFedchenkoAaronontheweb
authored andcommitted
Add config getter defaults as in Akka.Configuration (#178)
* Add config getter defaults as in Akka.Configuration * Updated tests
1 parent 82e45db commit 14164fd

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Hocon.Tests/HoconTests.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -420,8 +420,9 @@ public void CanSetDefaultValuesWhenGettingData()
420420
;
421421

422422
emptyConfig.GetStringList(missingKey, new List<string>()).Should().Equal(new List<string>());
423-
emptyConfig.Invoking(c => c.GetStringList(missingKey)).Should().Throw<HoconValueException>().Which
424-
.InnerException.Should().BeOfType<HoconParserException>();
423+
424+
emptyConfig.Invoking(c => c.GetStringList(missingKey)).Should().NotThrow("String list is an exception of the rule")
425+
.And.Subject().Should().BeEquivalentTo(new List<string>());
425426
;
426427
}
427428

src/Hocon/HoconRoot.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -662,8 +662,7 @@ public virtual IList<byte> GetByteList(HoconPath path, IList<byte> @default = nu
662662
public virtual IList<string> GetStringList(string path)
663663
{
664664
return WrapWithValueException(path,
665-
() => GetStringList(HoconPath.Parse(path)) ??
666-
throw new HoconParserException($"Hocon path {path} does not exist."));
665+
() => GetStringList(HoconPath.Parse(path)) ?? new List<string>());
667666
}
668667

669668
/// <summary>

0 commit comments

Comments
 (0)