@Test
public void testWhole_LargeObject() throws Exception {
final int type = Constants.OBJ_BLOB;
byte[] data = getRng().nextBytes(streamThreshold + 5);
RevBlob id = tr.blob(data);
tr.branch("master").commit().add("A", id).create();
tr.packAndPrune();
assertTrue("has blob", wc.has(id));
ObjectLoader ol = wc.open(id);
assertNotNull("created loader", ol);
assertEquals(type, ol.getType());
assertEquals(data.length, ol.getSize());
assertTrue("is large", ol.isLarge());
try {
ol.getCachedBytes();
fail("Should have thrown LargeObjectException");
} catch (LargeObjectException tooBig) {
assertEquals(MessageFormat.format(
JGitText.get().largeObjectException, id.name()), tooBig
.getMessage());
}
ObjectStream in = ol.openStream();
assertNotNull("have stream", in);