View Javadoc
1   package net.sf.mbus4j.decoder;
2   
3   /*
4    * #%L
5    * mbus4j-core
6    * %%
7    * Copyright (C) 2009 - 2014 MBus4J
8    * %%
9    * mbus4j - Drivers for the M-Bus protocol - http://mbus4j.sourceforge.net/
10   * Copyright (C) 2009-2014, mbus4j.sf.net, and individual contributors as indicated
11   * by the @authors tag. See the copyright.txt in the distribution for a
12   * full listing of individual contributors.
13   * 
14   * This is free software; you can redistribute it and/or modify it
15   * under the terms of the GNU General Public License as
16   * published by the Free Software Foundation; either version 3 of
17   * the License, or (at your option) any later version.
18   * 
19   * This software is distributed in the hope that it will be useful,
20   * but WITHOUT ANY WARRANTY; without even the implied warranty of
21   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22   * Lesser General Public License for more details.
23   * 
24   * You should have received a copy of the GNU Lesser General Public
25   * License along with this software; if not, write to the Free
26   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
27   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
28   * #L%
29   */
30  import java.util.Date;
31  import org.junit.After;
32  import org.junit.AfterClass;
33  import org.junit.Before;
34  import org.junit.BeforeClass;
35  import org.junit.Ignore;
36  import org.junit.Test;
37  import static org.junit.Assert.*;
38  
39  /**
40   *
41   * @author aploese
42   */
43  public class StackTest {
44  
45      public StackTest() {
46      }
47  
48      @BeforeClass
49      public static void setUpClass() throws Exception {
50      }
51  
52      @AfterClass
53      public static void tearDownClass() throws Exception {
54      }
55  
56      private Stack stack;
57  
58      @Before
59      public void setUp() {
60          stack = new Stack();
61      }
62  
63      @After
64      public void tearDown() {
65          stack = null;
66      }
67  
68      /**
69       * Test of peekIsTimestampRes1 method, of class Stack.
70       */
71      @Test
72      @Ignore
73      public void testPeekIsTimestampRes1() {
74          System.out.println("peekIsTimestampRes1");
75          Stack instance = new Stack();
76          boolean expResult = false;
77          boolean result = instance.peekIsTimestampRes1();
78          assertEquals(expResult, result);
79          // TODO review the generated test code and remove the default call to fail.
80          fail("The test case is a prototype.");
81      }
82  
83      /**
84       * Test of peekIsTimestampRes2 method, of class Stack.
85       */
86      @Test
87      @Ignore
88      public void testPeekIsTimestampRes2() {
89          System.out.println("peekIsTimestampRes2");
90          Stack instance = new Stack();
91          boolean expResult = false;
92          boolean result = instance.peekIsTimestampRes2();
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 peekIsTimestampRes3 method, of class Stack.
100      */
101     @Test
102     @Ignore
103     public void testPeekIsTimestampRes3() {
104         System.out.println("peekIsTimestampRes3");
105         Stack instance = new Stack();
106         boolean expResult = false;
107         boolean result = instance.peekIsTimestampRes3();
108         assertEquals(expResult, result);
109         // TODO review the generated test code and remove the default call to fail.
110         fail("The test case is a prototype.");
111     }
112 
113     /**
114      * Test of peekIsTimestampSummertime method, of class Stack.
115      */
116     @Test
117     @Ignore
118     public void testPeekIsTimestampSummertime() {
119         System.out.println("peekIsTimestampSummertime");
120         Stack instance = new Stack();
121         boolean expResult = false;
122         boolean result = instance.peekIsTimestampSummertime();
123         assertEquals(expResult, result);
124         // TODO review the generated test code and remove the default call to fail.
125         fail("The test case is a prototype.");
126     }
127 
128     /**
129      * Test of peekIsTimestampValid method, of class Stack.
130      */
131     @Test
132     @Ignore
133     public void testPeekIsTimestampValid() {
134         System.out.println("peekIsTimestampValid");
135         Stack instance = new Stack();
136         boolean expResult = false;
137         boolean result = instance.peekIsTimestampValid();
138         assertEquals(expResult, result);
139         // TODO review the generated test code and remove the default call to fail.
140         fail("The test case is a prototype.");
141     }
142 
143     /**
144      * Test of popBcdByte method, of class Stack.
145      */
146     @Test
147     public void testPopBcdByte() {
148         System.out.println("popBcdByte");
149         stack.init(1);
150         stack.push((byte) 0xF9);
151         assertNull(stack.peekBcdError(2));
152         assertEquals(-9, stack.popBcdByte());
153     }
154 
155     /**
156      * Test of peekBcdError method, of class Stack.
157      */
158     @Test
159     public void testPeekBcdError() {
160         System.out.println("peekBcdError");
161         stack.init(4);
162         stack.push((byte) 0xA9);
163         stack.push((byte) 0xCB);
164         stack.push((byte) 0xED);
165         stack.push((byte) 0xFF);
166         assertEquals("--E CbA9", stack.peekBcdError(8));
167         stack.init(1);
168         stack.push((byte) 0xFF);
169         assertEquals("--", stack.peekBcdError(2));
170     }
171 
172     /**
173      * Test of popBcdInteger method, of class Stack.
174      */
175     @Test
176     @Ignore
177     public void testPopBcdInteger() {
178         System.out.println("popBcdInteger");
179         int digits = 0;
180         Stack instance = new Stack();
181         int expResult = 0;
182         int result = instance.popBcdInteger(digits);
183         assertEquals(expResult, result);
184         // TODO review the generated test code and remove the default call to fail.
185         fail("The test case is a prototype.");
186     }
187 
188     /**
189      * Test of popBcdShort method, of class Stack.
190      */
191     @Test
192     @Ignore
193     public void testPopBcdShort() {
194         System.out.println("popBcdShort");
195         int digits = 0;
196         Stack instance = new Stack();
197         short expResult = 0;
198         short result = instance.popBcdShort(digits);
199         assertEquals(expResult, result);
200         // TODO review the generated test code and remove the default call to fail.
201         fail("The test case is a prototype.");
202     }
203 
204     /**
205      * Test of popBcdLong method, of class Stack.
206      */
207     @Test
208     @Ignore
209     public void testPopBcdLong() {
210         System.out.println("popBcdLong");
211         int digits = 0;
212         Stack instance = new Stack();
213         long expResult = 0L;
214         long result = instance.popBcdLong(digits);
215         assertEquals(expResult, result);
216         // TODO review the generated test code and remove the default call to fail.
217         fail("The test case is a prototype.");
218     }
219 
220     /**
221      * Test of popByte method, of class Stack.
222      */
223     @Test
224     @Ignore
225     public void testPopByte() {
226         System.out.println("popByte");
227         Stack instance = new Stack();
228         byte expResult = 0;
229         byte result = instance.popByte();
230         assertEquals(expResult, result);
231         // TODO review the generated test code and remove the default call to fail.
232         fail("The test case is a prototype.");
233     }
234 
235     /**
236      * Test of popBytes method, of class Stack.
237      */
238     @Test
239     @Ignore
240     public void testPopBytes() {
241         System.out.println("popBytes");
242         Stack instance = new Stack();
243         byte[] expResult = null;
244         byte[] result = instance.popBytes();
245         assertEquals(expResult, result);
246         // TODO review the generated test code and remove the default call to fail.
247         fail("The test case is a prototype.");
248     }
249 
250     /**
251      * Test of popDate method, of class Stack.
252      */
253     @Test
254     @Ignore
255     public void testPopDate() {
256         System.out.println("popDate");
257         Stack instance = new Stack();
258         Date expResult = null;
259         Date result = instance.popDate();
260         assertEquals(expResult, result);
261         // TODO review the generated test code and remove the default call to fail.
262         fail("The test case is a prototype.");
263     }
264 
265     /**
266      * Test of popFloat method, of class Stack.
267      */
268     @Test
269     @Ignore
270     public void testPopFloat() {
271         System.out.println("popFloat");
272         Stack instance = new Stack();
273         float expResult = 0.0F;
274         float result = instance.popFloat();
275         assertEquals(expResult, result, 0.0);
276         // TODO review the generated test code and remove the default call to fail.
277         fail("The test case is a prototype.");
278     }
279 
280     /**
281      * Test of popInteger method, of class Stack.
282      */
283     @Test
284     @Ignore
285     public void testPopInteger_0args() {
286         System.out.println("popInteger");
287         Stack instance = new Stack();
288         int expResult = 0;
289         int result = instance.popInteger();
290         assertEquals(expResult, result);
291         // TODO review the generated test code and remove the default call to fail.
292         fail("The test case is a prototype.");
293     }
294 
295     /**
296      * Test of popInteger method, of class Stack.
297      */
298     @Test
299     @Ignore
300     public void testPopInteger_int() {
301         System.out.println("popInteger");
302         int bytes = 0;
303         Stack instance = new Stack();
304         int expResult = 0;
305         int result = instance.popInteger(bytes);
306         assertEquals(expResult, result);
307         // TODO review the generated test code and remove the default call to fail.
308         fail("The test case is a prototype.");
309     }
310 
311     /**
312      * Test of popLong method, of class Stack.
313      */
314     @Test
315     @Ignore
316     public void testPopLong_0args() {
317         System.out.println("popLong");
318         Stack instance = new Stack();
319         long expResult = 0L;
320         long result = instance.popLong();
321         assertEquals(expResult, result);
322         // TODO review the generated test code and remove the default call to fail.
323         fail("The test case is a prototype.");
324     }
325 
326     /**
327      * Test of popLong method, of class Stack.
328      */
329     @Test
330     @Ignore
331     public void testPopLong_int() {
332         System.out.println("popLong");
333         int bytes = 0;
334         Stack instance = new Stack();
335         long expResult = 0L;
336         long result = instance.popLong(bytes);
337         assertEquals(expResult, result);
338         // TODO review the generated test code and remove the default call to fail.
339         fail("The test case is a prototype.");
340     }
341 
342     /**
343      * Test of popMan method, of class Stack.
344      */
345     @Test
346     @Ignore
347     public void testPopMan() {
348         System.out.println("popMan");
349         Stack instance = new Stack();
350         String expResult = "";
351         String result = instance.popMan();
352         assertEquals(expResult, result);
353         // TODO review the generated test code and remove the default call to fail.
354         fail("The test case is a prototype.");
355     }
356 
357     /**
358      * Test of popShort method, of class Stack.
359      */
360     @Test
361     @Ignore
362     public void testPopShort() {
363         System.out.println("popShort");
364         Stack instance = new Stack();
365         short expResult = 0;
366         short result = instance.popShort();
367         assertEquals(expResult, result);
368         // TODO review the generated test code and remove the default call to fail.
369         fail("The test case is a prototype.");
370     }
371 
372     /**
373      * Test of popString method, of class Stack.
374      */
375     @Test
376     @Ignore
377     public void testPopString() {
378         System.out.println("popString");
379         Stack instance = new Stack();
380         String expResult = "";
381         String result = instance.popString();
382         assertEquals(expResult, result);
383         // TODO review the generated test code and remove the default call to fail.
384         fail("The test case is a prototype.");
385     }
386 
387     /**
388      * Test of popTimeStamp method, of class Stack.
389      */
390     @Test
391     @Ignore
392     public void testPopTimeStamp() {
393         System.out.println("popTimeStamp");
394         Stack instance = new Stack();
395         Date expResult = null;
396         Date result = instance.popTimeStamp();
397         assertEquals(expResult, result);
398         // TODO review the generated test code and remove the default call to fail.
399         fail("The test case is a prototype.");
400     }
401 
402 }