1   /*
2    * To change this template, choose Tools | Templates
3    * and open the template in the editor.
4    */
5   package net.sf.openv4j;
6   
7   import org.junit.After;
8   import org.junit.AfterClass;
9   import static org.junit.Assert.*;
10  
11  import org.junit.Before;
12  import org.junit.BeforeClass;
13  import org.junit.Ignore;
14  import org.junit.Test;
15  
16  import net.sf.openv4j.protocolhandlers.DataContainer;
17  import net.sf.openv4j.protocolhandlers.MemoryImage;
18  import org.easymock.classextension.EasyMock;
19  
20  /**
21   * DOCUMENT ME!
22   *
23   * @author aploese
24   */
25  public class DataPointTest {
26      /**
27       * Creates a new DataPointTest object.
28       */
29      public DataPointTest() {
30      }
31  
32      /**
33       * DOCUMENT ME!
34       *
35       * @throws Exception DOCUMENT ME!
36       */
37      @BeforeClass
38      public static void setUpClass() throws Exception {
39      }
40  
41      /**
42       * DOCUMENT ME!
43       *
44       * @throws Exception DOCUMENT ME!
45       */
46      @AfterClass
47      public static void tearDownClass() throws Exception {
48      }
49  
50      /**
51       * DOCUMENT ME!
52       */
53      @Before
54      public void setUp() {
55      }
56  
57      /**
58       * DOCUMENT ME!
59       */
60      @After
61      public void tearDown() {
62      }
63  
64      /**
65       * Test of addressBelongsToMe method, of class DataPoint.
66       */
67      @Ignore
68      @Test
69      public void testAddressBelongsToMe() {
70          System.out.println("addressBelongsToMe");
71  
72          int addr = 0;
73          DataPoint instance = null;
74          boolean expResult = false;
75          boolean result = instance.addressBelongsToMe(addr);
76          assertEquals(expResult, result);
77          // TODO review the generated test code and remove the default call to fail.
78          fail("The test case is a prototype.");
79      }
80  
81      /**
82       * Test of decode method, of class DataPoint.
83       */
84      @Ignore
85      @Test
86      public void testDecode() {
87          System.out.println("decode");
88  
89          MemoryImage dc = null;
90          DataPoint instance = null;
91          Object expResult = null;
92          Object result = instance.decode(dc);
93          assertEquals(expResult, result);
94          // TODO review the generated test code and remove the default call to fail.
95          fail("The test case is a prototype.");
96      }
97  
98      /**
99       * Test of encode of byte value method, of class DataPoint.
100      */
101     @Test
102     public void testEncodeByte() {
103         System.out.println("encode Byte");
104         DataPoint instance = DataPoint.A1M1_CONFIG_OPERATING_TYPE;
105         Byte b = 1;
106         MemoryImage mi = EasyMock.createMock(MemoryImage.class);
107         mi.setByte(instance.getAddr(), b.byteValue());
108         EasyMock.replay(mi);
109         instance.encode(mi, b);
110         EasyMock.verify(mi);
111     }
112 
113     /**
114      * Test of encode of byte value method, of class DataPoint.
115      */
116     @Test
117     public void testEncodeDouble() {
118         System.out.println("encode Double");
119         DataPoint instance = DataPoint.M2_CONFIG_SLOPE;
120         Double d = 1.1;
121         MemoryImage mi = EasyMock.createMock(MemoryImage.class);
122         mi.setByte(instance.getAddr(), (byte)11);
123         EasyMock.replay(mi);
124         instance.encode(mi, d);
125         EasyMock.verify(mi);
126     }
127 
128     /**
129      * Test of findByAddr method, of class DataPoint.
130      */
131     @Ignore
132     @Test
133     public void testFindByAddr() {
134         System.out.println("findByAddr");
135 
136         int addr = 0;
137         DataPoint expResult = null;
138         DataPoint result = DataPoint.findByAddr(addr);
139         assertEquals(expResult, result);
140         // TODO review the generated test code and remove the default call to fail.
141         fail("The test case is a prototype.");
142     }
143 
144     /**
145      * Test of getAccess method, of class DataPoint.
146      */
147     @Ignore
148     @Test
149     public void testGetAccess() {
150         System.out.println("getAccess");
151 
152         DataPoint instance = null;
153         AccessType expResult = null;
154         AccessType result = instance.getAccess();
155         assertEquals(expResult, result);
156         // TODO review the generated test code and remove the default call to fail.
157         fail("The test case is a prototype.");
158     }
159 
160     /**
161      * Test of getAddr method, of class DataPoint.
162      */
163     @Ignore
164     @Test
165     public void testGetAddr() {
166         System.out.println("getAddr");
167 
168         DataPoint instance = null;
169         int expResult = 0;
170         int result = instance.getAddr();
171         assertEquals(expResult, result);
172         // TODO review the generated test code and remove the default call to fail.
173         fail("The test case is a prototype.");
174     }
175 
176     /**
177      * Test of getAlternative method, of class DataPoint.
178      */
179     @Ignore
180     @Test
181     public void testGetAlternative() {
182         System.out.println("getAlternative");
183 
184         DataPoint instance = null;
185         Alternative expResult = null;
186         Alternative result = instance.getAlternative();
187         assertEquals(expResult, result);
188         // TODO review the generated test code and remove the default call to fail.
189         fail("The test case is a prototype.");
190     }
191 
192     /**
193      * Test of getFactor method, of class DataPoint.
194      */
195     @Ignore
196     @Test
197     public void testGetFactor() {
198         System.out.println("getFactor");
199 
200         DataPoint instance = null;
201         double expResult = 0.0;
202         double result = instance.getFactor();
203         assertEquals(expResult, result, 0.0);
204         // TODO review the generated test code and remove the default call to fail.
205         fail("The test case is a prototype.");
206     }
207 
208     /**
209      * Test of getGroup method, of class DataPoint.
210      */
211     @Ignore
212     @Test
213     public void testGetGroup() {
214         System.out.println("getGroup");
215 
216         DataPoint instance = null;
217         Group expResult = null;
218         Group result = instance.getGroup();
219         assertEquals(expResult, result);
220         // TODO review the generated test code and remove the default call to fail.
221         fail("The test case is a prototype.");
222     }
223 
224     /**
225      * Test of getLabel method, of class DataPoint.
226      */
227     @Ignore
228     @Test
229     public void testGetLabel() {
230         System.out.println("getLabel");
231 
232         DataPoint instance = null;
233         String expResult = "";
234         String result = instance.getLabel();
235         assertEquals(expResult, result);
236         // TODO review the generated test code and remove the default call to fail.
237         fail("The test case is a prototype.");
238     }
239 
240     /**
241      * Test of getLength method, of class DataPoint.
242      */
243     @Ignore
244     @Test
245     public void testGetLength() {
246         System.out.println("getLength");
247 
248         DataPoint instance = null;
249         int expResult = 0;
250         int result = instance.getLength();
251         assertEquals(expResult, result);
252         // TODO review the generated test code and remove the default call to fail.
253         fail("The test case is a prototype.");
254     }
255 
256     /**
257      * Test of getName method, of class DataPoint.
258      */
259     @Ignore
260     @Test
261     public void testGetName() {
262         System.out.println("getName");
263 
264         DataPoint instance = null;
265         String expResult = "";
266         String result = instance.getName();
267         assertEquals(expResult, result);
268         // TODO review the generated test code and remove the default call to fail.
269         fail("The test case is a prototype.");
270     }
271 
272     /**
273      * Test of getSortedPoints method, of class DataPoint.
274      */
275     @Ignore
276     @Test
277     public void testGetSortedPoints() {
278         System.out.println("getSortedPoints");
279 
280         DataPoint[] expResult = null;
281         DataPoint[] result = DataPoint.getSortedPoints();
282         assertEquals(expResult, result);
283         // TODO review the generated test code and remove the default call to fail.
284         fail("The test case is a prototype.");
285     }
286 
287     /**
288      * Test of getType method, of class DataPoint.
289      */
290     @Ignore
291     @Test
292     public void testGetType() {
293         System.out.println("getType");
294 
295         DataPoint instance = null;
296         DataType expResult = null;
297         DataType result = instance.getType();
298         assertEquals(expResult, result);
299         // TODO review the generated test code and remove the default call to fail.
300         fail("The test case is a prototype.");
301     }
302 
303     /**
304      * Test of getValue method, of class DataPoint.
305      */
306     @Ignore
307     @Test
308     public void testGetValue() {
309         System.out.println("getValue");
310 
311         DataPoint instance = null;
312         Property expResult = null;
313         Property result = instance.getValue();
314         assertEquals(expResult, result);
315         // TODO review the generated test code and remove the default call to fail.
316         fail("The test case is a prototype.");
317     }
318 
319     /**
320      * Test of getValueKind method, of class DataPoint.
321      */
322     @Ignore
323     @Test
324     public void testGetValueKind() {
325         System.out.println("getValueKind");
326 
327         DataPoint instance = null;
328         PropertyType expResult = null;
329         PropertyType result = instance.getValueKind();
330         assertEquals(expResult, result);
331         // TODO review the generated test code and remove the default call to fail.
332         fail("The test case is a prototype.");
333     }
334 
335     /**
336      * Test of isInKnownBlock16 method, of class DataPoint.
337      */
338     @Ignore
339     @Test
340     public void testIsInKnownBlock16() {
341         System.out.println("isInKnownBlock16");
342 
343         int address = 0;
344         boolean expResult = false;
345         boolean result = DataPoint.isInKnownBlock16(address);
346         assertEquals(expResult, result);
347         // TODO review the generated test code and remove the default call to fail.
348         fail("The test case is a prototype.");
349     }
350 
351     /**
352      * Test of isInKnownBlocks16 method, of class DataPoint.
353      */
354     @Ignore
355     @Test
356     public void testIsInKnownBlocks16() {
357         System.out.println("isInKnownBlocks16");
358 
359         int address = 0;
360         int length = 0;
361         boolean expResult = false;
362         boolean result = DataPoint.isInKnownBlocks16(address, length);
363         assertEquals(expResult, result);
364         // TODO review the generated test code and remove the default call to fail.
365         fail("The test case is a prototype.");
366     }
367 
368     /**
369      * DOCUMENT ME!
370      */
371     @Test
372     public void testNamingConventions() {
373         for (DataPoint dp : DataPoint.values()) {
374             String expectedName = String.format("%s_%s_%s", dp.getGroup().name(), dp.getValueKind().name(), dp.getValue().name());
375 
376             if (!dp.name().equals(expectedName)) {
377                 expectedName = String.format("%s_%s_%s_AT_0X%04X", dp.getGroup().name(), dp.getValueKind().name(), dp.getValue().name(), dp.getAddr());
378                 assertEquals(expectedName, dp.getName());
379             }
380         }
381     }
382 
383     /**
384      * Test of printAddresses method, of class DataPoint.
385      */
386     @Ignore
387     @Test
388     public void testPrintAddresses() {
389         System.out.println("printAddresses");
390 
391         StringBuilder sb = null;
392         MemoryImage memImage = null;
393         DataPoint.printAddresses(sb, memImage);
394         // TODO review the generated test code and remove the default call to fail.
395         fail("The test case is a prototype.");
396     }
397 
398     /**
399      * Test of printAll method, of class DataPoint.
400      */
401     @Ignore
402     @Test
403     public void testPrintAll() {
404         System.out.println("printAll");
405 
406         StringBuilder sb = null;
407         DataContainer dc = null;
408         DataPoint.printAll(sb, dc);
409         // TODO review the generated test code and remove the default call to fail.
410         fail("The test case is a prototype.");
411     }
412 
413     /**
414      * Test of printMatchingAddesses method, of class DataPoint.
415      */
416     @Ignore
417     @Test
418     public void testPrintMatchingAddesses() {
419         System.out.println("printMatchingAddesses");
420 
421         DataPoint dataPoint = null;
422         MemoryImage mem = null;
423         StringBuilder sb = null;
424         DataPoint.printMatchingAddesses(dataPoint, mem, sb);
425         // TODO review the generated test code and remove the default call to fail.
426         fail("The test case is a prototype.");
427     }
428 
429     /**
430      * Test of toString method, of class DataPoint.
431      */
432     @Ignore
433     @Test
434     public void testToString() {
435         System.out.println("toString");
436 
437         MemoryImage mem = null;
438         StringBuilder sb = null;
439         DataPoint instance = null;
440         instance.toString(mem, sb);
441         // TODO review the generated test code and remove the default call to fail.
442         fail("The test case is a prototype.");
443     }
444 
445     /**
446      * Test of valueOf method, of class DataPoint.
447      */
448     @Ignore
449     @Test
450     public void testValueOf() {
451         System.out.println("valueOf");
452 
453         String name = "";
454         DataPoint expResult = null;
455         DataPoint result = DataPoint.valueOf(name);
456         assertEquals(expResult, result);
457         // TODO review the generated test code and remove the default call to fail.
458         fail("The test case is a prototype.");
459     }
460 
461     /**
462      * Test of values method, of class DataPoint.
463      */
464     @Ignore
465     @Test
466     public void testValues() {
467         System.out.println("values");
468 
469         DataPoint[] expResult = null;
470         DataPoint[] result = DataPoint.values();
471         assertEquals(expResult, result);
472         // TODO review the generated test code and remove the default call to fail.
473         fail("The test case is a prototype.");
474     }
475 }