@Test
  public void readIntoSecretBytes_throwsOnNotEnoughPseudorandomness() throws Exception {
    byte randomness = 4;
    InputStream shortInputStream =
        new InputStream() {
          int numReads = 3;

          @Override
          public int read() {
            return 0;
          }

          @Override
          public int read(byte[] b, int off, int len) {
            if (numReads == 0) {
              return -1;
            }
            --numReads;
            b[off] = randomness;
            return 1;
          }
        };
    assertThrows(
        GeneralSecurityException.class,
        () -> Util.readIntoSecretBytes(shortInputStream, 4, InsecureSecretKeyAccess.get()));
  }
Tests for Tink internal Util class.
java_src/src/test/java/com/google/crypto/tink/internal/UtilTest.java