App Engine SDKを1.7.0に更新した後、単体テストの一部が失敗し始めました。
SDK 1.6.xでは、次のようにBLOBが削除されたと主張しました。
try {
fileService.getBlobFile(blobKey);
Assert.fail("Blob not deleted: " + blobKey);
} catch (FileNotFoundException expected) {
// OK
}
SDK 1.7.0では、getBlobFile()はFileNotFoundExceptionをスローしなくなりました。
例外を引き起こそうとしましたが、うまくいきませんでした(例外はスローされません):
try {
AppEngineFile blobFile = fileService.getBlobFile(blobKey);
boolean readable = blobFile.isReadable();
FileReadChannel channel = fileService.openReadChannel(blobFile, false);
channel.position(1);
try {
channel.close();
} catch (Exception e) {
// Silent
}
Assert.fail("Blob not deleted: " + blobKey);
} catch (Exception expected) {
// OK
}
ブロブを削除する必要がありますが、そのためのチャネルを開くことは可能です...
それで、削除をチェックする方法のアイデアは、ユニットテストで成功しましたか?