@@ -22,6 +22,9 @@ namespace analyzeJSON
public static string GetNameFromPath(string tokenPath)
{
+ if (string.IsNullOrWhiteSpace(tokenPath))
+ return string.Empty;
+
return tokenPath.Split(".").Last();
}
@@ -11,5 +11,11 @@ namespace analyzeJSONTests
Assert.Throws<ArgumentNullException>(() => new AnalyzeJSON(null));
+ [Fact]
+ public void GetNameFromPath_NullTokenPath()
+ {
+ Assert.Empty(AnalyzeJSON.GetNameFromPath(null));
+ }