SpinnerMouseWheelListener.java

1
package com.jsql.view.swing.panel.preferences.listener;
2
3
import javax.swing.*;
4
import java.awt.event.MouseWheelEvent;
5
import java.awt.event.MouseWheelListener;
6
7
public class SpinnerMouseWheelListener implements MouseWheelListener {
8
    @Override
9
    public void mouseWheelMoved(MouseWheelEvent e) {
10
        JSpinner source = (JSpinner) e.getComponent();
11
        SpinnerNumberModel model = (SpinnerNumberModel) source.getModel();
12
        Integer oldValue = (Integer) source.getValue();
13 2 1. mouseWheelMoved : Replaced integer multiplication with division → NO_COVERAGE
2. mouseWheelMoved : Replaced integer subtraction with addition → NO_COVERAGE
        var intValue = oldValue - e.getWheelRotation() * model.getStepSize().intValue();
14
        int max = (Integer) model.getMaximum();
15
        int min = (Integer) model.getMinimum();
16 4 1. mouseWheelMoved : negated conditional → NO_COVERAGE
2. mouseWheelMoved : negated conditional → NO_COVERAGE
3. mouseWheelMoved : changed conditional boundary → NO_COVERAGE
4. mouseWheelMoved : changed conditional boundary → NO_COVERAGE
        if (min <= intValue && intValue <= max) {
17 1 1. mouseWheelMoved : removed call to javax/swing/JSpinner::setValue → NO_COVERAGE
            source.setValue(intValue);
18
        }
19
    }
20
}

Mutations

13

1.1
Location : mouseWheelMoved
Killed by : none
Replaced integer multiplication with division → NO_COVERAGE

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

16

1.1
Location : mouseWheelMoved
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : mouseWheelMoved
Killed by : none
negated conditional → NO_COVERAGE

3.3
Location : mouseWheelMoved
Killed by : none
changed conditional boundary → NO_COVERAGE

4.4
Location : mouseWheelMoved
Killed by : none
changed conditional boundary → NO_COVERAGE

17

1.1
Location : mouseWheelMoved
Killed by : none
removed call to javax/swing/JSpinner::setValue → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.19.1