I am writing a test class for a file uploader thingamajig I wrote. The class takes a blob representing the contents of the file. So far everything is going well and I've got 93% code coverage.
However, I'm a perfectionist and I want to bring that figure up to 100%. There's a part of my code that handles an exception that gets thrown when the file is too large to be inserted in the Documents object (a file over 5mb). I want to know if there's a way I can generate a blob over 5 MB in my test class to trigger that exception handler.
How do I generate a blob over 5MB programmatically in an Apex class? I tried making a massive string the way I would in python (i.e. String reallyBigString = "foo" * some_huge_number_here;
) but that doesn't work since Apex doesn't allow arithmetic operations on a string. Any way I can do this?