summaryrefslogtreecommitdiff
path: root/src/test/java/au/id/zancanaro/javacheck/object/MyObjectAddTest.java
blob: 884114cde4af896ff847806124d73d35a4ad2f83 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package au.id.zancanaro.javacheck.object;

import au.id.zancanaro.javacheck.annotations.Property;
import au.id.zancanaro.javacheck.junit.Properties;
import org.junit.runner.RunWith;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

@RunWith(Properties.class)
public class MyObjectAddTest {

    @Property
    public void testAdd(MyObject a, MyObject b) {
        MyObject added = a.add(b);
        assertTrue(added.string.length() == a.string.length() + b.string.length());
        assertTrue(added.value == a.value + b.value);
        assertEquals(added.subObject, a.subObject.add(b.subObject));
        assertEquals(added.subObject.value, a.subObject.value);
    }

}