Menu.java

1
package g0803.bindingofshiba.model.menu;
2
3
import java.util.ArrayList;
4
import java.util.Arrays;
5
import java.util.List;
6
7
public class Menu {
8
9
    private int index = 0;
10
    private final String title;
11
    private final List<MenuOption> options = new ArrayList<>();
12
13
    public Menu(String title, MenuOption... menuOptions) {
14
        this.title = title;
15
        options.addAll(Arrays.asList(menuOptions));
16
    }
17
18
    public List<MenuOption> getOptions() {
19 1 1. getOptions : replaced return value with Collections.emptyList for g0803/bindingofshiba/model/menu/Menu::getOptions → NO_COVERAGE
        return options;
20
    }
21
22
    public MenuOption getSelectedOption() {
23 1 1. getSelectedOption : replaced return value with null for g0803/bindingofshiba/model/menu/Menu::getSelectedOption → NO_COVERAGE
        return options.get(index);
24
    }
25
26
    public String getTitle() {
27 1 1. getTitle : replaced return value with "" for g0803/bindingofshiba/model/menu/Menu::getTitle → NO_COVERAGE
        return title;
28
    }
29
30
    public void nextOption() {
31 2 1. nextOption : Replaced integer subtraction with addition → NO_COVERAGE
2. nextOption : Replaced integer addition with subtraction → NO_COVERAGE
        index = Math.min(options.size() - 1, index + 1);
32
    }
33
34
    public void previousOption() {
35 1 1. previousOption : Replaced integer subtraction with addition → NO_COVERAGE
        index = Math.max(0, index - 1);
36
    }
37
}

Mutations

19

1.1
Location : getOptions
Killed by : none
replaced return value with Collections.emptyList for g0803/bindingofshiba/model/menu/Menu::getOptions → NO_COVERAGE

23

1.1
Location : getSelectedOption
Killed by : none
replaced return value with null for g0803/bindingofshiba/model/menu/Menu::getSelectedOption → NO_COVERAGE

27

1.1
Location : getTitle
Killed by : none
replaced return value with "" for g0803/bindingofshiba/model/menu/Menu::getTitle → NO_COVERAGE

31

1.1
Location : nextOption
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

2.2
Location : nextOption
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

35

1.1
Location : previousOption
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.7.0