| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
package org.fest.swing.driver; |
| 17 |
|
|
| 18 |
|
import static java.lang.String.valueOf; |
| 19 |
|
import static org.fest.util.Strings.concat; |
| 20 |
|
|
| 21 |
|
import javax.swing.JList; |
| 22 |
|
|
| 23 |
|
import org.fest.swing.annotation.RunsInCurrentThread; |
| 24 |
|
|
| 25 |
|
|
| 26 |
|
@link |
| 27 |
|
|
| 28 |
|
|
| 29 |
|
|
| 30 |
|
|
| 31 |
|
|
| 32 |
|
@author |
| 33 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (12) |
Complexity: 5 |
Complexity Density: 0.71 |
|
| 34 |
|
final class JListItemIndexValidator { |
| 35 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 36 |
112
|
@RunsInCurrentThread... |
| 37 |
|
static void validateIndex(JList list, int index) { |
| 38 |
112
|
validateIndex(index, list.getModel().getSize()); |
| 39 |
|
} |
| 40 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 41 |
21
|
@RunsInCurrentThread... |
| 42 |
|
static void validateIndices(final JList list, int...indices) { |
| 43 |
21
|
int itemCount = list.getModel().getSize(); |
| 44 |
39
|
for (int index : indices) validateIndex(index, itemCount); |
| 45 |
|
} |
| 46 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 3 |
Complexity Density: 1 |
|
| 47 |
151
|
private static void validateIndex(int index, int itemCount) {... |
| 48 |
132
|
if (index >= 0 && index < itemCount) return; |
| 49 |
19
|
throw new IndexOutOfBoundsException(concat( |
| 50 |
|
"Item index (", valueOf(index), ") should be between [", valueOf(0), "] and [", valueOf(itemCount - 1), "] (inclusive)")); |
| 51 |
|
} |
| 52 |
|
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 53 |
|
private JListItemIndexValidator() {}... |
| 54 |
|
} |