use of io.sloeber.core.txt.KeyValueTree in project arduino-eclipse-plugin by Sloeber.
the class TestTxtFile method getValuekey1.
@Test
public void getValuekey1() {
KeyValueTree root = getDataSet1();
String result = root.getValue("key2");
String expectedResult = "value2";
assertEquals("Wrong getvalue", expectedResult, result);
}
use of io.sloeber.core.txt.KeyValueTree in project arduino-eclipse-plugin by Sloeber.
the class TestTxtFile method dumpMatchesExpectationKey2.
@Test
public void dumpMatchesExpectationKey2() {
KeyValueTree root = getDataSet1();
KeyValueTree key1 = root.getChild("key2");
String result = key1.dump();
String expectedResult = "key2_1=value2_1\n";
assertEquals("select key 2", expectedResult, result);
}
use of io.sloeber.core.txt.KeyValueTree in project arduino-eclipse-plugin by Sloeber.
the class TestTxtFile method getDataSet1.
private KeyValueTree getDataSet1() {
KeyValueTree root = KeyValueTree.createTxtRoot();
KeyValueTree key2 = root.addChild("key2", "value2");
key2.addChild("key2_1", "value2_1");
KeyValueTree key1 = root.addChild("key1");
key1.addChild("key1_1", "value1_1");
key1.addChild("key1_2", "value1_2");
return root;
}
use of io.sloeber.core.txt.KeyValueTree in project arduino-eclipse-plugin by Sloeber.
the class TestTxtFile method dumpMatchesExpectationFull2.
@Test
public void dumpMatchesExpectationFull2() {
KeyValueTree root = getDataSet1();
root.addValue("he.I.Can.Do.This", "not once");
root.addValue("he.I.Can.Hit.This", "not twice");
root.addValue("he.I.Can.hit.This", "not three times");
root.addValue("Something.Completely.different", "but always");
String result = root.dump();
String expectedResult = "key2=value2\n" + "key2.key2_1=value2_1\n" + "key1.key1_1=value1_1\n" + "key1.key1_2=value1_2\n" + "he.I.Can.Do.This=not once\n" + "he.I.Can.Hit.This=not twice\n" + "he.I.Can.hit.This=not three times\n" + "Something.Completely.different=but always\n";
assertEquals("creation", expectedResult, result);
}
use of io.sloeber.core.txt.KeyValueTree in project arduino-eclipse-plugin by Sloeber.
the class TestTxtFile method dumpMatchesExpectationKey3.
@Test
public void dumpMatchesExpectationKey3() {
KeyValueTree root = getDataSet2();
KeyValueTree keyHe = root.getChild("he");
KeyValueTree keyI = keyHe.getChild("I");
KeyValueTree keyCan = keyI.getChild("Can");
String result = keyCan.dump();
String expectedResult = "Do.This=not once\n" + "Hit.This=not twice\n" + "hit.This=not three times\n";
assertEquals("select key 2", expectedResult, result);
}
Aggregations