@Test public void requiresSegmentation() { final UploadInstructions instructions = new UploadInstructions(new byte[] {0x01}); new NonStrictExpectations(instructions) { { instructions.requiresSegmentation(); result = true; } }; Container container1 = account.getContainer("alpha"); final AbstractStoredObject object = (AbstractStoredObject) container1.getObject("alpha"); new Expectations(object) { { object.uploadObjectAsSegments(instructions); result = null; times = 1; } }; object.uploadObject(instructions); }