Skip to content

Commit

Permalink
Increase test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
Veracity0 committed Mar 12, 2024
1 parent 306d7f1 commit 89ae69d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/net/sourceforge/kolmafia/session/LocketManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,11 @@ public static void decorateMonsterDropdown(final StringBuffer buffer) {
int monsterId = Integer.valueOf(matcher.group(1));
String name = matcher.group(2);
MonsterData monster = MonsterDatabase.findMonsterById(monsterId);
String monsterName = monster.getName();
if (monster != null && !name.equals(monsterName)) {
buffer.replace(matcher.start(2), matcher.end(2), monsterName);
if (monster != null) {
String monsterName = monster.getName();
if (!name.equals(monsterName)) {
buffer.replace(matcher.start(2), matcher.end(2), monsterName);
}
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion test/net/sourceforge/kolmafia/session/LocketManagerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ public void canDecorateAmbiguousMonsters() {
assertTrue(buffer.indexOf("<option value=\"553\" >spider gremlin</option>") != -1);
assertTrue(buffer.indexOf("<option value=\"551\" >vegetable gremlin</option>") != -1);

LocketManager.decorateMonsterDropdown(buffer);
// Ultimately calls LocketManager.decorateMonsterDropdown(buffer);
ChoiceAdventures.decorateChoice(1463, buffer, true);

assertTrue(buffer.indexOf("<option value=\"549\" >batwinged gremlin (tool)</option>") != -1);
assertTrue(buffer.indexOf("<option value=\"547\" >erudite gremlin (tool)</option>") != -1);
Expand Down

0 comments on commit 89ae69d

Please sign in to comment.