@Test
public void testRotateCleartext_shouldThrowExceptionIfExistingKeysetIsEmpty() throws Exception {

  InputStream emptyStream = new ByteArrayInputStream(new byte[0]);
  String masterKeyUri = null; // This ensures that the keyset won't be encrypted.
  String credentialPath = null;
  ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
  try {
    RotateKeysetCommand.rotate(
        outputStream, OUTPUT_FORMAT,
        emptyStream, INPUT_FORMAT,
        masterKeyUri, credentialPath, NEW_TEMPLATE);
    fail("Expected IOException");
  } catch (IOException e) {
    // expected
  }
}