Java Code Examples for com.google.cloud.datastore.LongValue#of()

The following examples show how to use com.google.cloud.datastore.LongValue#of() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LowerCaseStringIndexerTest.java    From catatumbo with Apache License 2.0 5 votes vote down vote up
@Test(expected = IndexingException.class)
public void testIndex_3() {
  LongValue input = LongValue.of(5L);
  try {
    Value<?> output = indexer.index(input);
  } catch (Exception exp) {
    LOGGER.log(Level.INFO, exp.toString());
    throw exp;
  }
}
 
Example 2
Source File: UpperCaseStringIndexerTest.java    From catatumbo with Apache License 2.0 5 votes vote down vote up
@Test(expected = IndexingException.class)
public void testIndex_3() {
  LongValue input = LongValue.of(5L);
  try {
    Value<?> output = indexer.index(input);
  } catch (Exception exp) {
    LOGGER.log(Level.INFO, exp.toString());
    throw exp;
  }
}
 
Example 3
Source File: UpperCaseStringListIndexerTest.java    From catatumbo with Apache License 2.0 5 votes vote down vote up
@Test(expected = IndexingException.class)
public void testIndex_5() {
  Value<?>[] inputArray = { StringValue.of("Hello"), NullValue.of(), LongValue.of(5L) };
  ListValue input = ListValue.of(Arrays.asList(inputArray));
  try {
    ListValue output = (ListValue) indexer.index(input);
  } catch (Exception exp) {
    LOGGER.log(Level.INFO, exp.toString());
    throw exp;
  }
}
 
Example 4
Source File: LowerCaseStringListIndexerTest.java    From catatumbo with Apache License 2.0 5 votes vote down vote up
@Test(expected = IndexingException.class)
public void testIndex_5() {
  Value<?>[] inputArray = { StringValue.of("Hello"), NullValue.of(), LongValue.of(5L) };
  ListValue input = ListValue.of(Arrays.asList(inputArray));
  try {
    ListValue output = (ListValue) indexer.index(input);
  } catch (Exception exp) {
    LOGGER.log(Level.INFO, exp.toString());
    throw exp;
  }
}
 
Example 5
Source File: DecimalMapperTest.java    From catatumbo with Apache License 2.0 5 votes vote down vote up
@Test
public void testToModel1() {
  DecimalMapper mapper = new DecimalMapper(6, 2);
  LongValue input = LongValue.of(999999L);
  BigDecimal output = (BigDecimal) mapper.toModel(input);
  assertEquals(new BigDecimal("9999.99"), output);

}
 
Example 6
Source File: DecimalMapperTest.java    From catatumbo with Apache License 2.0 5 votes vote down vote up
@Test
public void testToModel2() {
  DecimalMapper mapper = new DecimalMapper(6, 2);
  LongValue input = LongValue.of(0);
  BigDecimal output = (BigDecimal) mapper.toModel(input);
  assertEquals(new BigDecimal("0.00"), output);
}
 
Example 7
Source File: DecimalMapperTest.java    From catatumbo with Apache License 2.0 5 votes vote down vote up
@Test
public void testToModel3() {
  DecimalMapper mapper = new DecimalMapper(18, 18);
  LongValue input = LongValue.of(999999999999999999L);
  BigDecimal output = (BigDecimal) mapper.toModel(input);
  assertEquals(new BigDecimal("0.999999999999999999"), output);
}
 
Example 8
Source File: DecimalMapperTest.java    From catatumbo with Apache License 2.0 5 votes vote down vote up
@Test(expected = MappingException.class)
public void testToModel4() {
  try {
    DecimalMapper mapper = new DecimalMapper(5, 2);
    LongValue input = LongValue.of(123456);
    BigDecimal output = (BigDecimal) mapper.toModel(input);
    assertEquals(new BigDecimal("123.456"), output);
  } catch (Exception e) {
    System.err.println(e);
    throw e;
  }
}
 
Example 9
Source File: DecimalMapperTest.java    From catatumbo with Apache License 2.0 5 votes vote down vote up
@Test
public void testToModel5() {
  try {
    DecimalMapper mapper = new DecimalMapper(5, 2);
    LongValue input = LongValue.of(12345L);
    BigDecimal output = (BigDecimal) mapper.toModel(input);
    assertEquals(new BigDecimal("123.45"), output);
  } catch (Exception e) {
    System.err.println(e);
    throw e;
  }
}