Skip to content

Commit

Permalink
Clarify source of test values
Browse files Browse the repository at this point in the history
Show when default is from test vs. parent object
  • Loading branch information
MarkEWaite committed Jan 7, 2025
1 parent 8d73868 commit c0b5af5
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ public SorterStrategyCallback onNewItem(@NonNull Queue.Item item, SorterStrategy

private static MultiBucketStrategy strategy;
private static MultiBucketStrategy.MultiBucketStrategyDescriptor descriptor;
private static final int DEFAULT_PRIORITIES_NUMBER = 10;
private static final int DEFAULT_PRIORITY = 5;
private static final int TEST_PRIORITY_COUNT = 10;
private static final int TEST_PRIORITY_DEFAULT = 5;

@Before
public void setUp() {
strategy = new MultiBucketStrategy(DEFAULT_PRIORITIES_NUMBER, DEFAULT_PRIORITY) {
strategy = new MultiBucketStrategy(TEST_PRIORITY_COUNT, TEST_PRIORITY_DEFAULT) {
@Override
public SorterStrategyCallback onNewItem(@NonNull Queue.Item item, SorterStrategyCallback weightCallback) {
return weightCallback;
Expand All @@ -51,28 +51,28 @@ protected MultiBucketStrategy getStrategy() {

@Test
public void getNumberOfPrioritiesReturnsCorrectValue() {
assertEquals(10, strategy.getNumberOfPriorities());
assertEquals(TEST_PRIORITY_COUNT, strategy.getNumberOfPriorities());
}

@Test
public void getDefaultPriorityReturnsCorrectValue() {
assertEquals(5, strategy.getDefaultPriority());
assertEquals(TEST_PRIORITY_DEFAULT, strategy.getDefaultPriority());
}

@Test
public void doFillDefaultPriorityItemsReturnsCorrectItems() {
ListBoxModel items = descriptor.doFillDefaultPriorityItems();
assertEquals(10, items.size());
for (int i = 0; i < 10; i++) {
assertEquals(TEST_PRIORITY_COUNT, items.size());
for (int i = 0; i < TEST_PRIORITY_COUNT; i++) {
assertEquals(String.valueOf(i + 1), items.get(i).value);
}
}

@Test
public void doUpdateDefaultPriorityItemsHandlesInvalidInput() {
ListBoxModel items = descriptor.doUpdateDefaultPriorityItems("invalid");
assertEquals(3, items.size());
for (int i = 0; i < 3; i++) {
assertEquals(MultiBucketStrategy.DEFAULT_PRIORITY, items.size());
for (int i = 0; i < MultiBucketStrategy.DEFAULT_PRIORITY; i++) {
assertEquals(String.valueOf(i + 1), items.get(i).value);
}
}
Expand Down

0 comments on commit c0b5af5

Please sign in to comment.