()
| 170 | |
| 171 | |
| 172 | @Test |
| 173 | public void getSalt() { |
| 174 | PowerMockito.mockStatic(Const.class); |
| 175 | PowerMockito.when(Const.SALT_WIDTH()).thenReturn(0); |
| 176 | assertArrayEquals(new byte[] {}, RowKey.getSaltBytes(2)); |
| 177 | |
| 178 | PowerMockito.when(Const.SALT_WIDTH()).thenReturn(1); |
| 179 | assertArrayEquals(new byte[] { 2 }, RowKey.getSaltBytes(2)); |
| 180 | assertArrayEquals(new byte[] { 20 }, RowKey.getSaltBytes(20)); |
| 181 | |
| 182 | PowerMockito.when(Const.SALT_WIDTH()).thenReturn(2); |
| 183 | assertArrayEquals(new byte[] { 0, 20 }, RowKey.getSaltBytes(20)); |
| 184 | |
| 185 | PowerMockito.when(Const.SALT_WIDTH()).thenReturn(4); |
| 186 | assertArrayEquals(new byte[] { 0, 0, 0, 20 }, RowKey.getSaltBytes(20)); |
| 187 | |
| 188 | PowerMockito.when(Const.SALT_WIDTH()).thenReturn(1); |
| 189 | assertArrayEquals(new byte[] { -2 }, RowKey.getSaltBytes(-2)); |
| 190 | } |
| 191 | |
| 192 | @Test (expected = NegativeArraySizeException.class) |
| 193 | public void getSaltNegativeWidth() { |
nothing calls this directly
no test coverage detected