Package info.archinnov.achilles.test.integration.entity

Examples of info.archinnov.achilles.test.integration.entity.EntityWithAllTypes


    Long id = RandomUtils.nextLong(0,Long.MAX_VALUE);
    byte[] bytes = "toto".getBytes(Charsets.UTF_8);
    Date now = new Date();
    InetAddress inetAddress = InetAddresses.forString("192.168.0.1");

    EntityWithAllTypes entity = new EntityWithAllTypes();
    entity.setId(id);

    entity.setPrimitiveByte((byte) 7);
    entity.setObjectByte((byte) 7);
    entity.setByteArray(bytes);
    entity.setByteBuffer(ByteBuffer.wrap(bytes));

    entity.setPrimitiveBool(true);
    entity.setObjectBool(true);

    entity.setDate(now);

    entity.setPrimitiveDouble(1.0d);
    entity.setObjectDouble(1.0d);
    entity.setBigDecimal(new BigDecimal(1.11));

    entity.setPrimitiveFloat(1.0f);
    entity.setObjectFloat(1.0f);

    entity.setInetAddress(inetAddress);

    entity.setBigInt(new BigInteger("10"));
    entity.setPrimitiveInt(10);
    entity.setObjectInt(10);

    entity.setPrimitiveLong(10L);

    // When
    manager.insert(entity);
    EntityWithAllTypes found = manager.find(EntityWithAllTypes.class, id);

    // Then
    assertThat(found.getPrimitiveByte()).isEqualTo((byte) 7);
    assertThat(found.getObjectByte()).isEqualTo((byte) 7);
    assertThat(found.getByteArray()).isEqualTo(bytes);
    assertThat(found.getByteBuffer()).isEqualTo(ByteBuffer.wrap(bytes));

    assertThat(found.isPrimitiveBool()).isTrue();
    assertThat(found.getObjectBool()).isTrue();

    assertThat(found.getDate()).isEqualTo(now);

    assertThat(found.getPrimitiveDouble()).isEqualTo(1.0d);
    assertThat(found.getObjectDouble()).isEqualTo(1.0d);
    assertThat(found.getBigDecimal()).isEqualTo(new BigDecimal(1.11));

    assertThat(found.getPrimitiveFloat()).isEqualTo(1.0f);
    assertThat(found.getObjectFloat()).isEqualTo(1.0f);

    assertThat(found.getInetAddress()).isEqualTo(inetAddress);

    assertThat(found.getBigInt()).isEqualTo(new BigInteger("10"));
    assertThat(found.getPrimitiveInt()).isEqualTo(10);
    assertThat(found.getObjectInt()).isEqualTo(10);

    assertThat(found.getPrimitiveLong()).isEqualTo(10L);
  }
View Full Code Here

TOP

Related Classes of info.archinnov.achilles.test.integration.entity.EntityWithAllTypes

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.