SpinnerMouseWheelListener.java

1
package com.jsql.view.swing.panel.preferences;
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
    
9
    @Override
10
    public void mouseWheelMoved(MouseWheelEvent e) {
11
        
12
        JSpinner source = (JSpinner) e.getComponent();
13
        SpinnerNumberModel model = (SpinnerNumberModel) source.getModel();
14
        Integer oldValue = (Integer) source.getValue();
15 2 1. mouseWheelMoved : Replaced integer subtraction with addition → NO_COVERAGE
2. mouseWheelMoved : Replaced integer multiplication with division → NO_COVERAGE
        var intValue = oldValue - e.getWheelRotation() * model.getStepSize().intValue();
16
        int max = (Integer) model.getMaximum(); //1000
17
        int min = (Integer) model.getMinimum(); //0
18 4 1. mouseWheelMoved : negated conditional → NO_COVERAGE
2. mouseWheelMoved : changed conditional boundary → NO_COVERAGE
3. mouseWheelMoved : changed conditional boundary → NO_COVERAGE
4. mouseWheelMoved : negated conditional → NO_COVERAGE
        if (min <= intValue && intValue <= max) {
19 1 1. mouseWheelMoved : removed call to javax/swing/JSpinner::setValue → NO_COVERAGE
            source.setValue(intValue);
20
        }
21
    }
22
}

Mutations

15

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

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

18

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

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

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

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

19

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.16.1