mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
Fix unit test
This commit is contained in:
@@ -7,7 +7,7 @@ import org.junit.Assert
|
||||
class TemplateAttributeOptionTest: TestCase() {
|
||||
|
||||
fun testSerializeOptions() {
|
||||
val options = HashMap<String, String>().apply {
|
||||
val options = TemplateAttributeOption().apply {
|
||||
put("TestA", "TestB")
|
||||
put("{D", "}C")
|
||||
put("E,gyu", "15,jk")
|
||||
@@ -16,8 +16,9 @@ class TemplateAttributeOptionTest: TestCase() {
|
||||
|
||||
val strings = TemplateAttributeOption.getStringFromOptions(options)
|
||||
val optionsAfterSerialization = TemplateAttributeOption.getOptionsFromString(strings)
|
||||
val otherString = TemplateAttributeOption.getStringFromOptions(optionsAfterSerialization)
|
||||
|
||||
Assert.assertEquals("Output not equal to input", options, optionsAfterSerialization)
|
||||
Assert.assertEquals("Output not equal to input", strings, otherString)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -124,7 +124,7 @@ class TemplateAttributeOption() : Parcelable {
|
||||
return mOptions[label]
|
||||
}
|
||||
|
||||
fun add(label: String, value: String) {
|
||||
fun put(label: String, value: String) {
|
||||
mOptions[label] = value
|
||||
}
|
||||
|
||||
|
||||
@@ -158,7 +158,7 @@ class TemplateEngineCompatible(database: DatabaseKDBX): TemplateEngine(database)
|
||||
val attributeName = label.substring(TEMPLATE_ATTRIBUTE_OPTIONS_PREFIX.length)
|
||||
val attribute = getOrRetrieveAttributeFromName(attributes, attributeName)
|
||||
if (value.isNotEmpty()) {
|
||||
attribute.attribute.options.add(TEMPLATE_ATTRIBUTE_OPTIONS_TEMP, value)
|
||||
attribute.attribute.options.put(TEMPLATE_ATTRIBUTE_OPTIONS_TEMP, value)
|
||||
}
|
||||
entryCopy.removeField(field.name)
|
||||
} catch (e: Exception) {
|
||||
|
||||
Reference in New Issue
Block a user