Commit 8b93a99d authored by Peter van 't Hof's avatar Peter van 't Hof

Fixed typo

parent f4e420a9
......@@ -32,14 +32,15 @@ import scala.collection.JavaConversions._
object ConfigUtils extends Logging {
/**
* This method give back all nested values that does exist in map1 but not in map2
*
* @param map1 input map
* @param map2 input map
* @return Uniqe map1
*/
def uniqeKeys(map1: Map[String, Any], map2: Map[String, Any]): Map[String, Any] = {
def uniqueKeys(map1: Map[String, Any], map2: Map[String, Any]): Map[String, Any] = {
filterEmtpyMapValues(map1
.flatMap {
case (key, value: Map[_, _]) => Some(key -> uniqeKeys(value.asInstanceOf[Map[String, Any]], map2.getOrElse(key, Map()).asInstanceOf[Map[String, Any]]))
case (key, value: Map[_, _]) => Some(key -> uniqueKeys(value.asInstanceOf[Map[String, Any]], map2.getOrElse(key, Map()).asInstanceOf[Map[String, Any]]))
case (key, value) if !map2.contains(key) => Some(key -> value)
case _ => None
})
......
......@@ -215,7 +215,7 @@ class Config(protected var _map: Map[String, Any],
// Positions where values are found
val found = convertIndexValuesToMap(foundCache.filter(!_._2.default).toList.map(x => (x._2.foundIndex, x._2.value)))
val fixed = convertIndexValuesToMap(fixedCache.filter(!_._2.default).toList.map(x => (x._2.foundIndex, x._2.value)))
val unused = uniqeKeys(map, found)
val unused = uniqueKeys(map, found)
def reportUnused(map: Map[String, Any], path: List[String] = Nil): Unit = {
map.foreach {
......
......@@ -233,10 +233,10 @@ class ConfigUtilsTest extends TestNGSuite with Matchers {
}
@Test def testUniqeKeys: Unit = {
ConfigUtils.uniqeKeys(Map("bla" -> "bla"), Map("bla" -> "bla")) shouldBe Map()
ConfigUtils.uniqeKeys(Map("bla" -> "bla"), Map()) shouldBe Map("bla" -> "bla")
ConfigUtils.uniqeKeys(Map("bla" -> Map("bla" -> "bla")), Map("bla" -> Map("bla" -> "bla"))) shouldBe Map()
ConfigUtils.uniqeKeys(Map("bla" -> Map("bla" -> "bla")), Map("bla" -> Map())) shouldBe Map("bla" -> Map("bla" -> "bla"))
ConfigUtils.uniqueKeys(Map("bla" -> "bla"), Map("bla" -> "bla")) shouldBe Map()
ConfigUtils.uniqueKeys(Map("bla" -> "bla"), Map()) shouldBe Map("bla" -> "bla")
ConfigUtils.uniqueKeys(Map("bla" -> Map("bla" -> "bla")), Map("bla" -> Map("bla" -> "bla"))) shouldBe Map()
ConfigUtils.uniqueKeys(Map("bla" -> Map("bla" -> "bla")), Map("bla" -> Map())) shouldBe Map("bla" -> Map("bla" -> "bla"))
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment