Debian Codegraph @

src/test/java/com/github/markusbernhardt/proxy/util/PListParserTest.java

raw symbols SCIP
1 package com.github.markusbernhardt.proxy.util;
2
3 import static org.junit.Assert.assertNotNull;
4 import static org.junit.Assert.assertNull;
5 import static org.junit.Assert.assertTrue;
6
7 import java.io.File;
8 import java.io.IOException;
9
10 import org.junit.BeforeClass;
11 import org.junit.Test;
12
13 import com.github.markusbernhardt.proxy.TestUtil;
14 import com.github.markusbernhardt.proxy.util.PListParser.Dict;
15 import com.github.markusbernhardt.proxy.util.PListParser.XmlParseException;
16
17 /*****************************************************************************
18 *
19 * @author Markus Bernhardt, Copyright 2016
20 * @author Bernd Rosstauscher, Copyright 2009
21 ****************************************************************************/
22
23 public class PListParserTest {
24
25 private static final String TEST_SETTINGS = TestUtil.TEST_DATA_FOLDER + File.separator + "osx" + File.separator
26 + "osx_all.plist";
27
28 private static Dict pList;
29
30 /*************************************************************************
31 * Setup the dictionary from the test data file.
32 ************************************************************************/
33 @BeforeClass
34 public static void setupClass() throws XmlParseException, IOException {
35 pList = PListParser.load(new File(TEST_SETTINGS));
36 }
37
38 /**
39 * Test method for {@link com.btr.proxy.util.PListParser#load(java.io.File)}
40 * .
41 */
42 @Test
43 public void testLoadFile() {
44 assertTrue(pList.size() > 0);
45 }
46
47 /*************************************************************************
48 * Test method
49 ************************************************************************/
50
51 @Test
52 public void testStructure() {
53 String currentSet = (String) pList.get("CurrentSet");
54 assertNotNull(currentSet);
55 Object networkServices = pList.get("NetworkServices");
56 assertTrue(networkServices instanceof Dict);
57 }
58
59 /*************************************************************************
60 * Test method
61 ************************************************************************/
62
63 @Test
64 public void testNavigate() {
65 Object result = pList.getAtPath("NetworkServices/299B07C0-D0E0-4840-8486-9E77B9ED84DB/AppleTalk");
66 assertNotNull(result);
67 assertTrue(result instanceof Dict);
68 }
69
70 /*************************************************************************
71 * Test method
72 ************************************************************************/
73
74 @Test
75 public void testNavigate2() {
76 Object result = pList.getAtPath("/NetworkServices/299B07C0-D0E0-4840-8486-9E77B9ED84DB/AppleTalk");
77 assertNotNull(result);
78 assertTrue(result instanceof Dict);
79 }
80
81 /*************************************************************************
82 * Test method
83 ************************************************************************/
84
85 @Test
86 public void testNavigate3() {
87 Object result = pList.getAtPath("/NetworkServices/299B07C0-D0E0-4840-8486-9E77B9ED84DB/AppleTalk/");
88 assertNotNull(result);
89 assertTrue(result instanceof Dict);
90 }
91
92 /*************************************************************************
93 * Test method
94 ************************************************************************/
95
96 @Test
97 public void testNavigate4() {
98 Object result = pList.getAtPath("/NetworkServices/299B07C0-D0E0-4840-8486-9E77B9ED84DB/AppleTalkXXX/");
99 assertNull(result);
100 }
101
102 }