Created
August 14, 2015 14:09
-
-
Save danielshaya/e202dadd1bc29ef90af1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void allocationRegressionTest(){ | |
long limit = 1<<20; | |
ByteWatcher bw = new ByteWatcher(); | |
bw.onByteWatch((t, size) -> | |
//Allocation breached - cause an assertion to happen | |
assertTrue(String.format("%s exceeded limit: %d using: %d%n", | |
t.getName(), limit, size), false) | |
, limit); | |
//Run your program here | |
//..... | |
//..... | |
//If the bytes limit is breached ByteWatcher will call back the method | |
//onByteWatch and an assertion will be triggered. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment