I want to dump the following structure to a YAML file:
public class TestSuite {
String name
List testCases = []
}
Where the list of test cases are this class:
class TestCase {
String name
String id
}
What I want it to look like is this:
name: Carrier Handling and Traffic
testCases:
- name: Call setup by UE
id: DCM00000001
But it ends up looking like this:
name: Carrier Handling and Traffic
testCases:
- !!com.package.path.TestCase
name: Call setup by UE
id: DCM00000001
I guess it has to do with the fact that the List isn’t a tagged data structure but I can’t figure out how I can get the name of the test case to represent the object. Tips?
Does defining
TestSuiteas:Get you closer to the result you want? Not used SnakeYaml myself though…
Edit
Had some free time, and came up with this standalone test script:
Which prints: