MCPcopy Index your code
hub / github.com/OpenTSDB/opentsdb / getSalt

Method getSalt

test/core/TestRowKey.java:172–190  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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() {

Callers

nothing calls this directly

Calls 2

SALT_WIDTHMethod · 0.95
getSaltBytesMethod · 0.95

Tested by

no test coverage detected