Skip to content

Commit 7361918

Browse files
committed
test nonArg constructor with more types
1 parent e826cf7 commit 7361918

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

tests/objectbox-java-test/src/main/java/io/objectbox/NonArgConstructorTest.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import org.junit.Before;
44
import org.junit.Test;
55

6+
import java.util.Arrays;
7+
68
import io.objectbox.ModelBuilder.EntityBuilder;
79
import io.objectbox.model.EntityFlags;
810

@@ -29,12 +31,29 @@ protected void addOptionalFlagsToTestEntity(EntityBuilder entityBuilder) {
2931
public void testPutAndGet() {
3032
TestEntity entity = new TestEntity();
3133
entity.setSimpleInt(1977);
34+
entity.setSimpleBoolean(true);
35+
entity.setSimpleByte((byte) 42);
36+
byte[] bytes = {77, 78};
37+
entity.setSimpleByteArray(bytes);
38+
entity.setSimpleDouble(3.141);
39+
entity.setSimpleFloat(3.14f);
40+
entity.setSimpleLong(789437444354L);
41+
entity.setSimpleShort((short) 233);
42+
entity.setSimpleString("foo");
3243
long key = box.put(entity);
3344

3445
TestEntity entityRead = box.get(key);
3546
assertNotNull(entityRead);
3647
assertTrue(entityRead.noArgsConstructorCalled);
3748
assertEquals(1977, entityRead.getSimpleInt());
49+
assertTrue(entityRead.getSimpleBoolean());
50+
assertEquals(42, entityRead.getSimpleByte());
51+
assertEquals(233, entityRead.getSimpleShort());
52+
assertEquals(789437444354L, entityRead.getSimpleLong());
53+
assertEquals(3.14f, entityRead.getSimpleFloat(), 0.000001f);
54+
assertEquals(3.141f, entityRead.getSimpleDouble(), 0.000001);
55+
assertTrue(Arrays.equals(bytes, entityRead.getSimpleByteArray()));
56+
assertEquals("foo", entityRead.getSimpleString());
3857
}
3958

4059
}

0 commit comments

Comments
 (0)