|
16 | 16 |
|
17 | 17 | package com.google.cloud; |
18 | 18 |
|
| 19 | +import static com.google.common.truth.Truth.assertThat; |
19 | 20 | import static junit.framework.TestCase.assertFalse; |
20 | 21 | import static junit.framework.TestCase.assertTrue; |
21 | 22 | import static org.junit.Assert.assertArrayEquals; |
22 | 23 | import static org.junit.Assert.assertEquals; |
23 | 24 | import static org.junit.Assert.assertNull; |
24 | 25 |
|
25 | 26 | import com.google.cloud.spi.ServiceRpcFactory; |
26 | | - |
27 | | -import org.junit.Before; |
28 | | -import org.junit.Rule; |
29 | | -import org.junit.Test; |
30 | | -import org.junit.rules.ExpectedException; |
31 | | - |
32 | 27 | import java.io.IOException; |
33 | 28 | import java.io.Serializable; |
34 | 29 | import java.nio.ByteBuffer; |
35 | 30 | import java.nio.channels.ClosedChannelException; |
36 | 31 | import java.util.Arrays; |
37 | 32 | import java.util.Random; |
| 33 | +import org.junit.Before; |
| 34 | +import org.junit.Rule; |
| 35 | +import org.junit.Test; |
| 36 | +import org.junit.rules.ExpectedException; |
38 | 37 |
|
39 | 38 | public class BaseWriteChannelTest { |
40 | 39 |
|
@@ -111,11 +110,16 @@ public void testValidateOpen() throws IOException { |
111 | 110 | @Test |
112 | 111 | public void testChunkSize() { |
113 | 112 | channel.setChunkSize(42); |
114 | | - assertEquals(MIN_CHUNK_SIZE, channel.getChunkSize()); |
| 113 | + assertThat(channel.getChunkSize() >= MIN_CHUNK_SIZE).isTrue(); |
| 114 | + assertThat(channel.getChunkSize() % MIN_CHUNK_SIZE).isEqualTo(0); |
| 115 | + |
115 | 116 | channel.setChunkSize(2 * MIN_CHUNK_SIZE); |
116 | | - assertEquals(2 * MIN_CHUNK_SIZE, channel.getChunkSize()); |
117 | | - channel.setChunkSize(512 * 1025); |
118 | | - assertEquals(2 * MIN_CHUNK_SIZE, channel.getChunkSize()); |
| 117 | + assertThat(channel.getChunkSize() >= MIN_CHUNK_SIZE).isTrue(); |
| 118 | + assertThat(channel.getChunkSize() % MIN_CHUNK_SIZE).isEqualTo(0); |
| 119 | + |
| 120 | + channel.setChunkSize(2 * MIN_CHUNK_SIZE + 1); |
| 121 | + assertThat(channel.getChunkSize() >= MIN_CHUNK_SIZE).isTrue(); |
| 122 | + assertThat(channel.getChunkSize() % MIN_CHUNK_SIZE).isEqualTo(0); |
119 | 123 | } |
120 | 124 |
|
121 | 125 | @Test |
|
0 commit comments