EMMA Coverage Report (generated Wed Apr 19 22:57:21 CEST 2006)
[all classes][com.eaio.nativecall]

COVERAGE SUMMARY FOR SOURCE FILE [HolderTest.java]

nameclass, %method, %block, %line, %
HolderTest.java100% (1/1)83%  (5/6)79%  (102/129)86%  (24,9/29)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class HolderTest100% (1/1)83%  (5/6)79%  (102/129)86%  (24,9/29)
main (String []): void 0%   (0/1)0%   (0/17)0%   (0/2)
testHolder (): void 100% (1/1)18%  (2/11)50%  (2/4)
testGet (): void 100% (1/1)95%  (18/19)99%  (3,9/4)
HolderTest (String): void 100% (1/1)100% (4/4)100% (2/2)
testEqualsObject (): void 100% (1/1)100% (36/36)100% (8/8)
testHashCode (): void 100% (1/1)100% (42/42)100% (9/9)

1/* 
2 * HolderTest.java
3 * 
4 * Created on 05.01.2006.
5 *
6 * eaio: NativeCall - calling operating system methods from Java
7 * Copyright (c) 2004-2006 Johann Burkard (<mailto:jb@eaio.com>)
8 * <http://eaio.com>
9 * 
10 * Permission is hereby granted, free of charge, to any person obtaining a
11 * copy of this software and associated documentation files (the "Software"),
12 * to deal in the Software without restriction, including without limitation
13 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 * and/or sell copies of the Software, and to permit persons to whom the
15 * Software is furnished to do so, subject to the following conditions:
16 * 
17 * The above copyright notice and this permission notice shall be included
18 * in all copies or substantial portions of the Software.
19 * 
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
23 * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
24 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
25 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
26 * USE OR OTHER DEALINGS IN THE SOFTWARE.
27 * 
28 */
29package com.eaio.nativecall;
30 
31import java.util.HashSet;
32 
33import junit.framework.TestCase;
34 
35/**
36 * Test case for the {@link com.eaio.nativecall.Holder} class.
37 * 
38 * @author <a href="mailto:jb@eaio.com">Johann Burkard</a>
39 * @version $Id: HolderTest.java,v 1.2 2006/04/19 20:54:58 grnull Exp $
40 */
41public class HolderTest extends TestCase {
42 
43    /**
44     * Constructor for HolderTest.
45     * @param arg0
46     */
47    public HolderTest(String arg0) {
48        super(arg0);
49    }
50 
51    public static void main(String[] args) {
52        junit.awtui.TestRunner.run(HolderTest.class);
53    }
54 
55    public void testHolder() {
56        try {
57            new Holder(new Holder(null));
58            fail("Did not throw ClassCastException");
59        }
60        catch (ClassCastException ex) {}
61    }
62 
63    public void testHashCode() {
64        Holder h1 = new Holder(new Integer(10));
65        assertEquals(-7460404, h1.hashCode());
66        Holder h2 = new Holder(new Integer(10));
67        assertEquals(h1.hashCode(), h2.hashCode());
68 
69        HashSet set = new HashSet();
70        set.add(h1);
71        set.add(h2);
72        assertEquals(1, set.size());
73    }
74 
75    public void testGet() {
76        Integer i = new Integer(20);
77        Holder h = new Holder(i);
78        assertTrue(i == h.get());
79    }
80 
81    /*
82     * Test for boolean equals(Object)
83     */
84    public void testEqualsObject() {
85        Integer i = new Integer(42);
86        Holder h1 = new Holder(i);
87        Holder h2 = new Holder(i);
88        assertEquals(h1, h2);
89        assertFalse(h1.equals(null));
90        assertEquals(h1, h1);
91        assertFalse(h1.equals(new Holder(new Integer(0))));
92    }
93 
94}

[all classes][com.eaio.nativecall]
EMMA 2.0.4217 (C) Vladimir Roubtsov