1 package net.sf.mbus4j.devices;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31 import net.sf.mbus4j.dataframes.MBusMedium;
32
33 import org.junit.After;
34 import org.junit.AfterClass;
35 import static org.junit.Assert.*;
36
37 import org.junit.Before;
38 import org.junit.BeforeClass;
39 import org.junit.Ignore;
40 import org.junit.Test;
41
42 import java.io.ByteArrayInputStream;
43 import java.io.ByteArrayOutputStream;
44 import java.io.ObjectInputStream;
45 import java.io.ObjectOutputStream;
46 import java.util.Map;
47
48
49
50
51
52 public class GenericDeviceTest {
53
54 private GenericDevice instance;
55
56 public GenericDeviceTest() {
57 }
58
59 @BeforeClass
60 public static void setUpClass()
61 throws Exception {
62 }
63
64 @AfterClass
65 public static void tearDownClass()
66 throws Exception {
67 }
68
69 @Before
70 public void setUp() {
71 }
72
73 @After
74 public void tearDown() {
75 }
76
77
78
79
80 @Test
81 @Ignore
82 public void testGetManufacturer() {
83 System.out.println("getManufacturer");
84
85 GenericDevice instance = null;
86 String expResult = "";
87 String result = instance.getManufacturer();
88 assertEquals(expResult, result);
89
90 fail("The test case is a prototype.");
91 }
92
93
94
95
96 @Test
97 @Ignore
98 public void testGetMedium() {
99 System.out.println("getMedium");
100
101 GenericDevice instance = null;
102 MBusMedium expResult = null;
103 MBusMedium result = instance.getMedium();
104 assertEquals(expResult, result);
105
106 fail("The test case is a prototype.");
107 }
108
109
110
111
112 @Test
113 @Ignore
114 public void testReadValues()
115 throws Exception {
116 System.out.println("readValues");
117
118 Sender sender = null;
119 GenericDevice instance = null;
120 Map expResult = null;
121
122 fail("The test case is a prototype.");
123 }
124
125 @Test
126 @Ignore
127 public void testSerialize()
128 throws Exception {
129 ByteArrayOutputStream bos = new ByteArrayOutputStream();
130 ObjectOutputStream objOut = new ObjectOutputStream(bos);
131 objOut.writeObject(instance);
132 objOut.close();
133
134 ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
135 System.out.println(String.format("Serialized AcwHeatmeter: (size: %s) %s",
136 bos.size(),
137 bos.toString()));
138
139 GenericDevice result = (GenericDevice) new ObjectInputStream(bis).readObject();
140 assertEquals(instance, result);
141 System.out.println(instance.toString());
142 System.out.println(result.toString());
143 assertEquals(instance.isAcd(),
144 result.isAcd());
145 assertEquals(instance.isDfc(),
146 result.isDfc());
147 }
148 }