void testFromBytes() { byte[] val = new byte[] {0x34, 0x12}; ZipShort zs = new ZipShort(val); assertEquals("value from bytes", 0x1234, zs.getValue()); } /** * Test the contract of the equals method. */ public void testEquals() { ZipShort zs = new ZipShort(0x1234); ZipShort zs2 = new ZipShort(0x1234); ZipShort zs3 = new ZipShort(0x5678); assertTrue("reflexive", zs.equals(zs)); assertTrue("works", zs.equals(zs2)); assertTrue("works, part two", !zs.equals(zs3)); assertTrue("symmetric", zs2.equals(zs)); assertTrue("null handling", !zs.equals(null)); assertTrue("non ZipShort handling", !zs.equals(new Integer(0x1234))); } /** * Test sign handling. */ public void testSign() { ZipShort zs = new ZipShort(new byte[] {(byte)0xFF, (byte)0xFF}); assertEquals(0x0000FFFF, zs.getValue());
void testFromBytes() { byte[] val = new byte[] {0x78, 0x56, 0x34, 0x12}; ZipLong zl = new ZipLong(val); assertEquals("value from bytes", 0x12345678, zl.getValue()); } /** * Test the contract of the equals method. */ public void testEquals() { ZipLong zl = new ZipLong(0x12345678); ZipLong zl2 = new ZipLong(0x12345678); ZipLong zl3 = new ZipLong(0x87654321); assertTrue("reflexive", zl.equals(zl)); assertTrue("works", zl.equals(zl2)); assertTrue("works, part two", !zl.equals(zl3)); assertTrue("symmetric", zl2.equals(zl)); assertTrue("null handling", !zl.equals(null)); assertTrue("non ZipLong handling", !zl.equals(new Integer(0x1234))); } /** * Test sign handling. */ public void testSign() { ZipLong zl = new ZipLong(new byte[] {(byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF}); assertEquals(0x00000000FFFFFFFFl, zl.getValue());
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/zip/ZipShortTest.java File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/zip/ZipLongTest.java
Method name: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
void testFromBytes() {
1
void testFromBytes() {
2
        byte[] val = new byte[] {0x34, 0x12};
2
        byte[] val = new byte[] {0x78, 0x56, 0x34, 0x12};
3
        ZipShort zs = new ZipShort(val);
3
        ZipLong zl = new ZipLong(val);
4
        assertEquals("value from bytes", 0x1234, zs.getValue());
4
        assertEquals("value from bytes", 0x12345678, zl.getValue());
5
    }
5
    }
6
    /**
6
    /**
7
     * Test the contract of the equals method.
7
     * Test the contract of the equals method.
8
     */
8
     */
9
    public void testEquals() {
9
    public void testEquals() {
10
        ZipShort zs = new ZipShort(0x1234);
10
        ZipLong zl = new ZipLong(0x12345678);
11
        ZipShort zs2 = new ZipShort(0x1234);
11
        ZipLong zl2 = new ZipLong(0x12345678);
12
        ZipShort zs3 = new ZipShort(0x5678);
12
        ZipLong zl3 = new ZipLong(0x87654321);
13
        assertTrue("reflexive", zs.equals(zs));
13
        assertTrue("reflexive", zl.equals(zl));
14
        assertTrue("works", zs.equals(zs2));
14
        assertTrue("works", zl.equals(zl2));
15
        assertTrue("works, part two", !zs.equals(zs3));
15
        assertTrue("works, part two", !zl.equals(zl3));
16
        assertTrue("symmetric", zs2.equals(zs));
16
        assertTrue("symmetric", zl2.equals(zl));
17
        assertTrue("null handling", !zs.equals(null));
17
        assertTrue("null handling", !zl.equals(null));
18
        assertTrue("non ZipShort handling", !zs.equals(new Integer(0x1234)));
18
        assertTrue("non ZipLong handling", !zl.equals(new Integer(0x1234)));
19
    }
19
    }
20
    /**
20
    /**
21
     * Test sign handling.
21
     * Test sign handling.
22
     */
22
     */
23
    public void testSign() {
23
    public void testSign() {
24
        ZipShort zs = new ZipShort(new byte[] {(byte)0xFF, (byte)0xFF});
24
        ZipLong zl = new ZipLong(new byte[] {(byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF});
25
        assertEquals(0x0000FFFF, zs.getValue());
25
        assertEquals(0x00000000FFFFFFFFl, zl.getValue());
26
    
26
    
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones location
Number of node comparisons0