@Test
public void shouldAlignToNextMultipleOfAlignment() {

   final int alignment = 512;
   assertThat(align(0, alignment), is(0));
   assertThat(align(1, alignment), is(alignment));
   assertThat(align(alignment, alignment), is(alignment));
   assertThat(align(alignment + 1, alignment), is(alignment * 2));
   final int remainder = Integer.MAX_VALUE % alignment;
   final int alignedMax = Integer.MAX_VALUE - remainder;
   assertThat(align(alignedMax, alignment), is(alignedMax));
   //given that Integer.MAX_VALUE is the max value that can be represented with int
   //the aligned value would be > 2^32, but (int)(2^32) = Integer.MIN_VALUE due to the sign bit
   assertThat(align(Integer.MAX_VALUE, alignment), is(Integer.MIN_VALUE));
}