@Test
void testCastToIntSafely() {

  assertEquals(0, Resource.castToIntSafely(0));
  assertEquals(1, Resource.castToIntSafely(1));
  assertEquals(Integer.MAX_VALUE,
      Resource.castToIntSafely(Integer.MAX_VALUE));
  assertEquals(Integer.MAX_VALUE,
      Resource.castToIntSafely(Integer.MAX_VALUE + 1L),
      "Cast to Integer.MAX_VALUE if the long is greater than "
          + "Integer.MAX_VALUE");
  assertEquals(Integer.MAX_VALUE,
      Resource.castToIntSafely(Long.MAX_VALUE),
      "Cast to Integer.MAX_VALUE if the long is greater than "
          + "Integer.MAX_VALUE");
}