PanelTrailingAddress.java

1
package com.jsql.view.swing.panel.address;
2
3
import com.jsql.model.injection.strategy.AbstractStrategy;
4
import com.jsql.model.injection.strategy.StrategyError;
5
import com.jsql.model.injection.engine.model.Engine;
6
import com.jsql.model.injection.engine.model.yaml.Method;
7
import com.jsql.util.I18nUtil;
8
import com.jsql.util.LogLevelUtil;
9
import com.jsql.view.swing.panel.PanelAddressBar;
10
import com.jsql.view.swing.text.JToolTipI18n;
11
import com.jsql.view.swing.util.I18nViewUtil;
12
import com.jsql.view.swing.util.MediatorHelper;
13
import com.jsql.view.swing.util.UiUtil;
14
import org.apache.logging.log4j.LogManager;
15
import org.apache.logging.log4j.Logger;
16
17
import javax.swing.*;
18
import java.awt.*;
19
import java.awt.event.MouseAdapter;
20
import java.awt.event.MouseEvent;
21
import java.util.Arrays;
22
import java.util.Locale;
23
import java.util.concurrent.atomic.AtomicReference;
24
import java.util.stream.StreamSupport;
25
26
public class PanelTrailingAddress extends JPanel {
27
28
    private static final Logger LOGGER = LogManager.getRootLogger();
29
30
    public static final String MENU_STRATEGY = "menuStrategy";
31
    public static final String ITEM_RADIO_STRATEGY_ERROR = "itemRadioStrategyError";
32
    public static final String MENU_VENDOR = "menuVendor";
33
    public static final String ITEM_RADIO_VENDOR = "itemRadioVendor";
34
    public static final String PARAM_AUTO = "Param auto";
35
36
    private JMenu itemRadioStrategyError;
37
38
    private final JLabel labelTarget = new JLabel(UiUtil.ARROW_DOWN.getIcon(), SwingConstants.LEFT);
39
    private final JLabel labelEngine = new JLabel(UiUtil.ARROW_DOWN.getIcon(), SwingConstants.LEFT);
40
    private final JLabel labelStrategy = new JLabel(UiUtil.ARROW_DOWN.getIcon(), SwingConstants.LEFT);
41
    private ButtonGroup groupRadio = new ButtonGroup();
42
    private final JPopupMenu popupMenuEngines = new JPopupMenu();
43
    private final JPopupMenu popupMenuStrategies = new JPopupMenu();
44
45
    private final ButtonGroup groupStrategy = new ButtonGroup();
46
    public static final String PREFIX_NAME_ERROR = "itemRadioError";
47
    private static final String I18N_TOOLTIP_STRATEGY = "STRATEGY_%s_TOOLTIP";
48
49
    /**
50
     * Loader displayed during injection.
51
     */
52
    private final JProgressBar loader;
53
54
    /**
55
     * Connection button.
56
     */
57
    public final ButtonStart buttonStart = new ButtonStart();
58
    
59
    public PanelTrailingAddress(PanelAddressBar panelAddressBar) {
60 1 1. <init> : removed call to com/jsql/view/swing/panel/address/ButtonStart::addActionListener → NO_COVERAGE
        this.buttonStart.addActionListener(new ActionStart(panelAddressBar));
61 1 1. <init> : removed call to com/jsql/view/swing/panel/address/PanelTrailingAddress::setOpaque → NO_COVERAGE
        this.setOpaque(false);
62 1 1. <init> : removed call to com/jsql/view/swing/panel/address/PanelTrailingAddress::setBorder → NO_COVERAGE
        this.setBorder(null);
63 1 1. <init> : removed call to javax/swing/JLabel::setText → NO_COVERAGE
        this.labelStrategy.setText("Strategy auto");
64 1 1. <init> : removed call to javax/swing/JLabel::setName → NO_COVERAGE
        this.labelStrategy.setName(PanelTrailingAddress.MENU_STRATEGY);
65
66
        for (final AbstractStrategy strategy: MediatorHelper.model().getMediatorStrategy().getStrategies()) {
67
            var nameStrategy = strategy.getName().toUpperCase(Locale.ROOT);
68
            JMenuItem itemRadioStrategy;
69 1 1. <init> : negated conditional → NO_COVERAGE
            if (strategy == MediatorHelper.model().getMediatorStrategy().getError()) {
70
                itemRadioStrategy = new JMenu(strategy.toString());
71
                this.itemRadioStrategyError = (JMenu) itemRadioStrategy;
72 1 1. <init> : removed call to java/awt/Component::setName → NO_COVERAGE
                itemRadioStrategy.getComponent().setName(PanelTrailingAddress.ITEM_RADIO_STRATEGY_ERROR);
73
            } else {
74
                var atomicTooltip = new AtomicReference<>(new JToolTipI18n(
75
                    I18nUtil.valueByKey(String.format(PanelTrailingAddress.I18N_TOOLTIP_STRATEGY, nameStrategy))
76
                ));
77
                itemRadioStrategy = new JRadioButtonMenuItem(strategy.toString()) {
78
                    @Override
79
                    public JToolTip createToolTip() {
80 1 1. createToolTip : removed call to java/util/concurrent/atomic/AtomicReference::set → NO_COVERAGE
                        atomicTooltip.set(new JToolTipI18n(
81
                            I18nUtil.valueByKey(
82
                                String.format(PanelTrailingAddress.I18N_TOOLTIP_STRATEGY, nameStrategy)
83
                            )
84
                        ));
85 1 1. createToolTip : replaced return value with null for com/jsql/view/swing/panel/address/PanelTrailingAddress$1::createToolTip → NO_COVERAGE
                        return atomicTooltip.get();
86
                    }
87
                };
88 1 1. <init> : removed call to com/jsql/view/swing/util/I18nViewUtil::addComponentForKey → NO_COVERAGE
                I18nViewUtil.addComponentForKey(
89
                    String.format(PanelTrailingAddress.I18N_TOOLTIP_STRATEGY, nameStrategy),
90
                    atomicTooltip.get()
91
                );
92 1 1. <init> : removed call to java/awt/Component::setName → NO_COVERAGE
                itemRadioStrategy.getComponent().setName("itemRadioStrategy" + strategy);
93 1 1. <init> : removed call to javax/swing/JMenuItem::addActionListener → NO_COVERAGE
                itemRadioStrategy.addActionListener(actionEvent -> {
94 1 1. lambda$new$0 : removed call to javax/swing/JLabel::setText → NO_COVERAGE
                    this.labelStrategy.setText(strategy.toString());
95 1 1. lambda$new$0 : removed call to com/jsql/model/injection/strategy/MediatorStrategy::setStrategy → NO_COVERAGE
                    MediatorHelper.model().getMediatorStrategy().setStrategy(strategy);
96
                });
97 1 1. <init> : removed call to javax/swing/ButtonGroup::add → NO_COVERAGE
                this.groupStrategy.add(itemRadioStrategy);
98
            }
99
100
            this.popupMenuStrategies.add(itemRadioStrategy);
101 1 1. <init> : removed call to javax/swing/JMenuItem::setToolTipText → NO_COVERAGE
            itemRadioStrategy.setToolTipText(
102
                I18nUtil.valueByKey(String.format(PanelTrailingAddress.I18N_TOOLTIP_STRATEGY, nameStrategy))
103
            );
104 1 1. <init> : removed call to javax/swing/JMenuItem::setEnabled → NO_COVERAGE
            itemRadioStrategy.setEnabled(false);
105
        }
106
107 1 1. <init> : removed call to javax/swing/JLabel::setText → NO_COVERAGE
        this.labelEngine.setText(MediatorHelper.model().getMediatorEngine().getAuto().toString());
108 1 1. <init> : removed call to javax/swing/JLabel::setName → NO_COVERAGE
        this.labelEngine.setName(PanelTrailingAddress.MENU_VENDOR);
109 1 1. <init> : removed call to javax/swing/JPopupMenu::setLayout → NO_COVERAGE
        this.popupMenuEngines.setLayout(UiUtil.getColumnLayout(MediatorHelper.model().getMediatorEngine().getEngines().size()));
110
        var groupEngine = new ButtonGroup();
111
        for (final Engine engine : MediatorHelper.model().getMediatorEngine().getEngines()) {
112 1 1. <init> : negated conditional → NO_COVERAGE
            JMenuItem itemRadioEngine = new JRadioButtonMenuItem(engine.toString(), engine == MediatorHelper.model().getMediatorEngine().getAuto());
113 1 1. <init> : removed call to javax/swing/JMenuItem::setName → NO_COVERAGE
            itemRadioEngine.setName(PanelTrailingAddress.ITEM_RADIO_VENDOR + engine);
114 1 1. <init> : removed call to javax/swing/JMenuItem::addActionListener → NO_COVERAGE
            itemRadioEngine.addActionListener(actionEvent -> {
115 1 1. lambda$new$1 : removed call to javax/swing/JLabel::setText → NO_COVERAGE
                this.labelEngine.setText(engine.toString());
116 1 1. lambda$new$1 : removed call to com/jsql/model/injection/engine/MediatorEngine::setEngineByUser → NO_COVERAGE
                MediatorHelper.model().getMediatorEngine().setEngineByUser(engine);
117
            });
118
            this.popupMenuEngines.add(itemRadioEngine);
119 1 1. <init> : removed call to javax/swing/ButtonGroup::add → NO_COVERAGE
            groupEngine.add(itemRadioEngine);
120
        }
121
122
        this.loader = new JProgressBar();
123
        var dimension = UIManager.getDimension("ProgressBar.horizontalSize");
124 1 1. <init> : removed call to javax/swing/JProgressBar::setPreferredSize → NO_COVERAGE
        this.loader.setPreferredSize(new Dimension(32, dimension.height));
125 1 1. <init> : removed call to javax/swing/JProgressBar::setIndeterminate → NO_COVERAGE
        this.loader.setIndeterminate(true);
126
        this.add(this.loader);
127
128 1 1. <init> : removed call to javax/swing/JLabel::addMouseListener → NO_COVERAGE
        this.labelEngine.addMouseListener(new MouseAdapter() {
129
            @Override
130
            public void mousePressed(MouseEvent e) {
131
                Arrays.stream(PanelTrailingAddress.this.popupMenuEngines.getComponents())
132
                    .map(JComponent.class::cast)
133 1 1. mousePressed : removed call to java/util/stream/Stream::forEach → NO_COVERAGE
                    .forEach(JComponent::updateUI);  // required: incorrect when dark/light mode switch
134 1 1. mousePressed : removed call to javax/swing/JPopupMenu::updateUI → NO_COVERAGE
                PanelTrailingAddress.this.popupMenuEngines.updateUI();  // required: incorrect when dark/light mode switch
135 1 1. mousePressed : removed call to javax/swing/SwingUtilities::invokeLater → NO_COVERAGE
                SwingUtilities.invokeLater(() -> {  // reduce flickering on linux
136 3 1. lambda$mousePressed$0 : Replaced integer addition with subtraction → NO_COVERAGE
2. lambda$mousePressed$0 : removed call to javax/swing/JPopupMenu::show → NO_COVERAGE
3. lambda$mousePressed$0 : Replaced integer addition with subtraction → NO_COVERAGE
                    PanelTrailingAddress.this.popupMenuEngines.show(e.getComponent(), e.getComponent().getX(),5 + e.getComponent().getY() + e.getComponent().getHeight());
137 3 1. lambda$mousePressed$0 : Replaced integer addition with subtraction → NO_COVERAGE
2. lambda$mousePressed$0 : Replaced integer addition with subtraction → NO_COVERAGE
3. lambda$mousePressed$0 : removed call to javax/swing/JPopupMenu::setLocation → NO_COVERAGE
                    PanelTrailingAddress.this.popupMenuEngines.setLocation(e.getComponent().getLocationOnScreen().x,5 + e.getComponent().getLocationOnScreen().y + e.getComponent().getHeight());
138
                });
139
            }
140
        });
141 1 1. <init> : removed call to javax/swing/JLabel::addMouseListener → NO_COVERAGE
        this.labelStrategy.addMouseListener(new MouseAdapter() {
142
            @Override
143
            public void mousePressed(MouseEvent e) {
144
                Arrays.stream(PanelTrailingAddress.this.popupMenuStrategies.getComponents())
145
                    .map(JComponent.class::cast)
146 1 1. mousePressed : removed call to java/util/stream/Stream::forEach → NO_COVERAGE
                    .forEach(JComponent::updateUI);  // required: incorrect when dark/light mode switch
147 2 1. mousePressed : negated conditional → NO_COVERAGE
2. mousePressed : changed conditional boundary → NO_COVERAGE
                for (var i = 0 ; i < PanelTrailingAddress.this.getMenuError().getItemCount() ; i++) {
148 1 1. mousePressed : removed call to javax/swing/JMenuItem::updateUI → NO_COVERAGE
                    PanelTrailingAddress.this.getMenuError().getItem(i).updateUI();  // required: incorrect when dark/light mode switch
149
                }
150 1 1. mousePressed : removed call to javax/swing/JPopupMenu::updateUI → NO_COVERAGE
                PanelTrailingAddress.this.popupMenuStrategies.updateUI();  // required: incorrect when dark/light mode switch
151 1 1. mousePressed : removed call to javax/swing/SwingUtilities::invokeLater → NO_COVERAGE
                SwingUtilities.invokeLater(() -> {  // reduce flickering on linux
152 3 1. lambda$mousePressed$0 : Replaced integer addition with subtraction → NO_COVERAGE
2. lambda$mousePressed$0 : Replaced integer addition with subtraction → NO_COVERAGE
3. lambda$mousePressed$0 : removed call to javax/swing/JPopupMenu::show → NO_COVERAGE
                    PanelTrailingAddress.this.popupMenuStrategies.show(e.getComponent(), e.getComponent().getX(),5 + e.getComponent().getY() + e.getComponent().getHeight());
153 3 1. lambda$mousePressed$0 : Replaced integer addition with subtraction → NO_COVERAGE
2. lambda$mousePressed$0 : removed call to javax/swing/JPopupMenu::setLocation → NO_COVERAGE
3. lambda$mousePressed$0 : Replaced integer addition with subtraction → NO_COVERAGE
                    PanelTrailingAddress.this.popupMenuStrategies.setLocation(e.getComponent().getLocationOnScreen().x,5 + e.getComponent().getLocationOnScreen().y + e.getComponent().getHeight());
154
                });
155
            }
156
        });
157
158 1 1. <init> : removed call to javax/swing/JLabel::setText → NO_COVERAGE
        this.labelTarget.setText(PanelTrailingAddress.PARAM_AUTO);
159 1 1. <init> : removed call to javax/swing/JLabel::addMouseListener → NO_COVERAGE
        this.labelTarget.addMouseListener(new TargetMouseAdapter(this, panelAddressBar));
160
161
        this.add(this.labelTarget);
162
        this.add(this.labelEngine);
163
        this.add(this.labelStrategy);
164
        this.add(this.buttonStart);
165 1 1. <init> : removed call to com/jsql/view/swing/panel/address/PanelTrailingAddress::setCursor → NO_COVERAGE
        this.setCursor(Cursor.getDefaultCursor());
166 1 1. <init> : removed call to javax/swing/JProgressBar::setVisible → NO_COVERAGE
        this.loader.setVisible(false);
167
    }
168
169
    public void endPreparation() {
170 1 1. endPreparation : removed call to com/jsql/view/swing/panel/address/ButtonStart::setToolTipText → NO_COVERAGE
        this.buttonStart.setToolTipText(I18nUtil.valueByKey("BUTTON_START_TOOLTIP"));
171 1 1. endPreparation : removed call to com/jsql/view/swing/panel/address/ButtonStart::setInjectionReady → NO_COVERAGE
        this.buttonStart.setInjectionReady();
172 1 1. endPreparation : removed call to javax/swing/JProgressBar::setVisible → NO_COVERAGE
        this.loader.setVisible(false);
173
    }
174
    
175
    public void reset() {
176 1 1. reset : removed call to javax/swing/JLabel::setText → NO_COVERAGE
        this.labelStrategy.setText("Strategy auto");
177 1 1. reset : negated conditional → NO_COVERAGE
        if (MediatorHelper.model().getMediatorEngine().getEngineByUser() == MediatorHelper.model().getMediatorEngine().getAuto()) {
178 1 1. reset : removed call to javax/swing/JLabel::setText → NO_COVERAGE
            this.labelEngine.setText(MediatorHelper.model().getMediatorEngine().getAuto().toString());
179
        }
180
        Arrays.stream(this.popupMenuStrategies.getComponents())
181 2 1. reset : removed call to java/util/stream/Stream::forEach → NO_COVERAGE
2. lambda$reset$2 : removed call to java/awt/Component::setEnabled → NO_COVERAGE
            .forEach(component -> component.setEnabled(false));
182 1 1. reset : removed call to javax/swing/JMenu::removeAll → NO_COVERAGE
        this.getMenuError().removeAll();
183
184 1 1. reset : removed call to javax/swing/ButtonGroup::clearSelection → NO_COVERAGE
        this.groupStrategy.clearSelection();
185 1 1. lambda$reset$3 : replaced return value with null for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$reset$3 → NO_COVERAGE
        Iterable<AbstractButton> iterable = () -> this.groupStrategy.getElements().asIterator();
186
        StreamSupport.stream(iterable.spliterator(), false)
187 2 1. lambda$reset$4 : replaced boolean return with false for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$reset$4 → NO_COVERAGE
2. lambda$reset$4 : replaced boolean return with true for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$reset$4 → NO_COVERAGE
            .filter(abstractButton -> abstractButton.getName().startsWith(PanelTrailingAddress.PREFIX_NAME_ERROR))
188 1 1. reset : removed call to java/util/stream/Stream::forEach → NO_COVERAGE
            .forEach(this.groupStrategy::remove);
189
    }
190
    
191
    public void setEngine(Engine engine) {
192 1 1. setEngine : removed call to javax/swing/JLabel::setText → NO_COVERAGE
        this.labelEngine.setText(engine.toString());
193 1 1. setEngine : removed call to javax/swing/JMenu::removeAll → NO_COVERAGE
        this.itemRadioStrategyError.removeAll();
194
        var indexError = 0;
195
        if (
196 1 1. setEngine : negated conditional → NO_COVERAGE
            engine != MediatorHelper.model().getMediatorEngine().getAuto()
197 1 1. setEngine : negated conditional → NO_COVERAGE
            && engine.instance().getModelYaml().getStrategy().getError() != null
198
        ) {
199
            for (Method methodError: engine.instance().getModelYaml().getStrategy().getError().getMethod()) {
200
                JMenuItem itemRadioError = new JRadioButtonMenuItem(methodError.getName());
201 1 1. setEngine : removed call to javax/swing/JMenuItem::setEnabled → NO_COVERAGE
                itemRadioError.setEnabled(false);
202 1 1. setEngine : removed call to javax/swing/JMenuItem::setName → NO_COVERAGE
                itemRadioError.setName(PanelTrailingAddress.PREFIX_NAME_ERROR + methodError.getName());
203
                this.itemRadioStrategyError.add(itemRadioError);
204 1 1. setEngine : removed call to javax/swing/ButtonGroup::add → NO_COVERAGE
                this.groupStrategy.add(itemRadioError);
205
                int indexErrorFinal = indexError;
206 1 1. setEngine : removed call to javax/swing/JMenuItem::addActionListener → NO_COVERAGE
                itemRadioError.addActionListener(actionEvent -> {
207 1 1. lambda$setEngine$5 : removed call to javax/swing/JLabel::setText → NO_COVERAGE
                    this.labelStrategy.setText(methodError.getName());
208 1 1. lambda$setEngine$5 : removed call to com/jsql/model/injection/strategy/MediatorStrategy::setStrategy → NO_COVERAGE
                    MediatorHelper.model().getMediatorStrategy().setStrategy(MediatorHelper.model().getMediatorStrategy().getError());
209 1 1. lambda$setEngine$5 : removed call to com/jsql/model/injection/strategy/StrategyError::setIndexErrorStrategy → NO_COVERAGE
                    MediatorHelper.model().getMediatorStrategy().getError().setIndexErrorStrategy(indexErrorFinal);
210
                });
211 1 1. setEngine : Changed increment from 1 to -1 → NO_COVERAGE
                indexError++;
212
            }
213
        }
214
    }
215
    
216
    public void activateStrategy(AbstractStrategy strategy) {
217 1 1. activateStrategy : negated conditional → NO_COVERAGE
        if (strategy instanceof StrategyError strategyError) {
218 1 1. activateStrategy : removed call to javax/swing/JLabel::setText → NO_COVERAGE
            this.labelStrategy.setText(strategyError.toString());
219
            int indexError = strategyError.getIndexErrorStrategy();
220
            String nameError = MediatorHelper.model().getMediatorEngine().getEngine().instance().getModelYaml().getStrategy().getError().getMethod().get(
221
                indexError
222
            ).getName();
223
224
            Arrays.stream(this.getMenuError().getMenuComponents())
225
                .map(JRadioButtonMenuItem.class::cast)
226 2 1. lambda$activateStrategy$6 : replaced boolean return with true for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$activateStrategy$6 → NO_COVERAGE
2. lambda$activateStrategy$6 : replaced boolean return with false for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$activateStrategy$6 → NO_COVERAGE
                .filter(component -> component.getText().equals(nameError))
227 1 1. activateStrategy : removed call to java/util/stream/Stream::forEach → NO_COVERAGE
                .forEach(jRadioButtonMenuItem -> {
228 1 1. lambda$activateStrategy$7 : removed call to javax/swing/JRadioButtonMenuItem::setSelected → NO_COVERAGE
                    jRadioButtonMenuItem.setSelected(true);
229 1 1. lambda$activateStrategy$7 : removed call to javax/swing/JLabel::setText → NO_COVERAGE
                    this.labelStrategy.setText(nameError);
230
                });
231
        } else {
232 1 1. activateStrategy : removed call to javax/swing/JLabel::setText → NO_COVERAGE
            this.labelStrategy.setText(strategy.toString());
233
            Arrays.stream(this.popupMenuStrategies.getComponents())
234
                .map(JMenuItem.class::cast)
235 2 1. lambda$activateStrategy$8 : replaced boolean return with false for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$activateStrategy$8 → NO_COVERAGE
2. lambda$activateStrategy$8 : replaced boolean return with true for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$activateStrategy$8 → NO_COVERAGE
                .filter(jMenuItem -> jMenuItem.getText().equals(strategy.toString()))
236 2 1. lambda$activateStrategy$9 : removed call to javax/swing/JMenuItem::setSelected → NO_COVERAGE
2. activateStrategy : removed call to java/util/stream/Stream::forEach → NO_COVERAGE
                .forEach(jMenuItem -> jMenuItem.setSelected(true));
237
        }
238
    }
239
240
    public void markInvulnerable(AbstractStrategy strategy) {
241
        Arrays.stream(this.popupMenuStrategies.getComponents())
242
            .map(JMenuItem.class::cast)
243 2 1. lambda$markInvulnerable$10 : replaced boolean return with true for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$markInvulnerable$10 → NO_COVERAGE
2. lambda$markInvulnerable$10 : replaced boolean return with false for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$markInvulnerable$10 → NO_COVERAGE
            .filter(jMenuItem -> jMenuItem.getText().equals(strategy.toString()))
244 2 1. markInvulnerable : removed call to java/util/stream/Stream::forEach → NO_COVERAGE
2. lambda$markInvulnerable$11 : removed call to javax/swing/JMenuItem::setEnabled → NO_COVERAGE
            .forEach(jMenuItem -> jMenuItem.setEnabled(false));
245
    }
246
    
247
    public void markInvulnerable(int indexMethodError, AbstractStrategy strategy) {
248
        Arrays.stream(this.popupMenuStrategies.getSubElements())
249
            .map(JMenuItem.class::cast)
250 2 1. lambda$markInvulnerable$12 : replaced boolean return with false for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$markInvulnerable$12 → NO_COVERAGE
2. lambda$markInvulnerable$12 : replaced boolean return with true for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$markInvulnerable$12 → NO_COVERAGE
            .filter(jMenuItem -> jMenuItem.getText().equals(strategy.toString()))
251
            .map(JMenu.class::cast)
252
            .filter(jMenuItem -> {
253
                var isNotNull = true;
254
                // Fix #36975: ArrayIndexOutOfBoundsException on getItem()
255
                // Fix #40352: NullPointerException on ?
256
                // Fix #95855: NPE on setEnabled()
257
                try {
258 1 1. lambda$markInvulnerable$13 : negated conditional → NO_COVERAGE
                    isNotNull = jMenuItem.getItem(indexMethodError) != null;
259
                } catch (ArrayIndexOutOfBoundsException e) {
260
                    LOGGER.log(LogLevelUtil.CONSOLE_JAVA, e, e);
261 1 1. lambda$markInvulnerable$13 : replaced boolean return with true for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$markInvulnerable$13 → NO_COVERAGE
                    return false;
262
                }
263 2 1. lambda$markInvulnerable$13 : replaced boolean return with false for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$markInvulnerable$13 → NO_COVERAGE
2. lambda$markInvulnerable$13 : replaced boolean return with true for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$markInvulnerable$13 → NO_COVERAGE
                return isNotNull;
264
            })
265 2 1. lambda$markInvulnerable$14 : removed call to javax/swing/JMenuItem::setEnabled → NO_COVERAGE
2. markInvulnerable : removed call to java/util/stream/Stream::forEach → NO_COVERAGE
            .forEach(jMenuItem -> jMenuItem.getItem(indexMethodError).setEnabled(false));
266
    }
267
268
    private JMenu getMenuError() {
269
        var nameError = MediatorHelper.model().getMediatorStrategy().getError().getName();
270 1 1. getMenuError : replaced return value with null for com/jsql/view/swing/panel/address/PanelTrailingAddress::getMenuError → NO_COVERAGE
        return (JMenu) Arrays.stream(this.popupMenuStrategies.getComponents())
271
            .map(JMenuItem.class::cast)
272 2 1. lambda$getMenuError$15 : replaced boolean return with true for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$getMenuError$15 → NO_COVERAGE
2. lambda$getMenuError$15 : replaced boolean return with false for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$getMenuError$15 → NO_COVERAGE
            .filter(jMenuItem -> jMenuItem.getText().equalsIgnoreCase(nameError))
273
            .findFirst()
274
            .orElse(new JMenuItem("Mock"));
275
    }
276
277
    public void markVulnerable(AbstractStrategy strategy) {
278
        Arrays.stream(this.popupMenuStrategies.getComponents())
279
            .map(JMenuItem.class::cast)
280 2 1. lambda$markVulnerable$16 : replaced boolean return with false for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$markVulnerable$16 → NO_COVERAGE
2. lambda$markVulnerable$16 : replaced boolean return with true for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$markVulnerable$16 → NO_COVERAGE
            .filter(jMenuItem -> jMenuItem.getText().equals(strategy.toString()))
281 2 1. lambda$markVulnerable$17 : removed call to javax/swing/JMenuItem::setEnabled → NO_COVERAGE
2. markVulnerable : removed call to java/util/stream/Stream::forEach → NO_COVERAGE
            .forEach(jMenuItem -> jMenuItem.setEnabled(true));
282
    }
283
284
    public void markVulnerable(int indexMethodError, AbstractStrategy strategy) {
285
        // Fix #46578: ArrayIndexOutOfBoundsException on getItem()
286
        try {
287
            Arrays.stream(this.popupMenuStrategies.getComponents())
288
                .map(JMenuItem.class::cast)
289 2 1. lambda$markVulnerable$18 : replaced boolean return with true for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$markVulnerable$18 → NO_COVERAGE
2. lambda$markVulnerable$18 : replaced boolean return with false for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$markVulnerable$18 → NO_COVERAGE
                .filter(jMenuItem -> jMenuItem.getText().equals(strategy.toString()))
290
                .map(JMenu.class::cast)
291 2 1. lambda$markVulnerable$19 : negated conditional → NO_COVERAGE
2. lambda$markVulnerable$19 : replaced boolean return with true for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$markVulnerable$19 → NO_COVERAGE
                .filter(jMenuItem -> jMenuItem.getItem(indexMethodError) != null)
292 1 1. markVulnerable : removed call to java/util/stream/Stream::forEach → NO_COVERAGE
                .forEach(jMenuItem -> {
293 1 1. lambda$markVulnerable$20 : removed call to javax/swing/JMenu::setEnabled → NO_COVERAGE
                    jMenuItem.setEnabled(true);
294 1 1. lambda$markVulnerable$20 : removed call to javax/swing/JMenuItem::setEnabled → NO_COVERAGE
                    jMenuItem.getItem(indexMethodError).setEnabled(true);
295
                });
296
        } catch (ArrayIndexOutOfBoundsException e) {
297
            LOGGER.log(LogLevelUtil.CONSOLE_JAVA, e, e);
298
        }
299
    }
300
301
302
    // Getter and setter
303
304
    public JComponent getLoader() {
305 1 1. getLoader : replaced return value with null for com/jsql/view/swing/panel/address/PanelTrailingAddress::getLoader → NO_COVERAGE
        return this.loader;
306
    }
307
308
    public ButtonStart getButtonStart() {
309 1 1. getButtonStart : replaced return value with null for com/jsql/view/swing/panel/address/PanelTrailingAddress::getButtonStart → NO_COVERAGE
        return this.buttonStart;
310
    }
311
312
    public JLabel getLabelTarget() {
313 1 1. getLabelTarget : replaced return value with null for com/jsql/view/swing/panel/address/PanelTrailingAddress::getLabelTarget → NO_COVERAGE
        return this.labelTarget;
314
    }
315
316
    public ButtonGroup getGroupRadio() {
317 1 1. getGroupRadio : replaced return value with null for com/jsql/view/swing/panel/address/PanelTrailingAddress::getGroupRadio → NO_COVERAGE
        return this.groupRadio;
318
    }
319
320
    public void setGroupRadio(ButtonGroup groupRadio) {
321
        this.groupRadio = groupRadio;
322
    }
323
}

Mutations

60

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/panel/address/ButtonStart::addActionListener → NO_COVERAGE

61

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/panel/address/PanelTrailingAddress::setOpaque → NO_COVERAGE

62

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/panel/address/PanelTrailingAddress::setBorder → NO_COVERAGE

63

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JLabel::setText → NO_COVERAGE

64

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JLabel::setName → NO_COVERAGE

69

1.1
Location : <init>
Killed by : none
negated conditional → NO_COVERAGE

72

1.1
Location : <init>
Killed by : none
removed call to java/awt/Component::setName → NO_COVERAGE

80

1.1
Location : createToolTip
Killed by : none
removed call to java/util/concurrent/atomic/AtomicReference::set → NO_COVERAGE

85

1.1
Location : createToolTip
Killed by : none
replaced return value with null for com/jsql/view/swing/panel/address/PanelTrailingAddress$1::createToolTip → NO_COVERAGE

88

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/util/I18nViewUtil::addComponentForKey → NO_COVERAGE

92

1.1
Location : <init>
Killed by : none
removed call to java/awt/Component::setName → NO_COVERAGE

93

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JMenuItem::addActionListener → NO_COVERAGE

94

1.1
Location : lambda$new$0
Killed by : none
removed call to javax/swing/JLabel::setText → NO_COVERAGE

95

1.1
Location : lambda$new$0
Killed by : none
removed call to com/jsql/model/injection/strategy/MediatorStrategy::setStrategy → NO_COVERAGE

97

1.1
Location : <init>
Killed by : none
removed call to javax/swing/ButtonGroup::add → NO_COVERAGE

101

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JMenuItem::setToolTipText → NO_COVERAGE

104

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JMenuItem::setEnabled → NO_COVERAGE

107

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JLabel::setText → NO_COVERAGE

108

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JLabel::setName → NO_COVERAGE

109

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JPopupMenu::setLayout → NO_COVERAGE

112

1.1
Location : <init>
Killed by : none
negated conditional → NO_COVERAGE

113

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JMenuItem::setName → NO_COVERAGE

114

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JMenuItem::addActionListener → NO_COVERAGE

115

1.1
Location : lambda$new$1
Killed by : none
removed call to javax/swing/JLabel::setText → NO_COVERAGE

116

1.1
Location : lambda$new$1
Killed by : none
removed call to com/jsql/model/injection/engine/MediatorEngine::setEngineByUser → NO_COVERAGE

119

1.1
Location : <init>
Killed by : none
removed call to javax/swing/ButtonGroup::add → NO_COVERAGE

124

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JProgressBar::setPreferredSize → NO_COVERAGE

125

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JProgressBar::setIndeterminate → NO_COVERAGE

128

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JLabel::addMouseListener → NO_COVERAGE

133

1.1
Location : mousePressed
Killed by : none
removed call to java/util/stream/Stream::forEach → NO_COVERAGE

134

1.1
Location : mousePressed
Killed by : none
removed call to javax/swing/JPopupMenu::updateUI → NO_COVERAGE

135

1.1
Location : mousePressed
Killed by : none
removed call to javax/swing/SwingUtilities::invokeLater → NO_COVERAGE

136

1.1
Location : lambda$mousePressed$0
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

2.2
Location : lambda$mousePressed$0
Killed by : none
removed call to javax/swing/JPopupMenu::show → NO_COVERAGE

3.3
Location : lambda$mousePressed$0
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

137

1.1
Location : lambda$mousePressed$0
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

2.2
Location : lambda$mousePressed$0
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

3.3
Location : lambda$mousePressed$0
Killed by : none
removed call to javax/swing/JPopupMenu::setLocation → NO_COVERAGE

141

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JLabel::addMouseListener → NO_COVERAGE

146

1.1
Location : mousePressed
Killed by : none
removed call to java/util/stream/Stream::forEach → NO_COVERAGE

147

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

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

148

1.1
Location : mousePressed
Killed by : none
removed call to javax/swing/JMenuItem::updateUI → NO_COVERAGE

150

1.1
Location : mousePressed
Killed by : none
removed call to javax/swing/JPopupMenu::updateUI → NO_COVERAGE

151

1.1
Location : mousePressed
Killed by : none
removed call to javax/swing/SwingUtilities::invokeLater → NO_COVERAGE

152

1.1
Location : lambda$mousePressed$0
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

2.2
Location : lambda$mousePressed$0
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

3.3
Location : lambda$mousePressed$0
Killed by : none
removed call to javax/swing/JPopupMenu::show → NO_COVERAGE

153

1.1
Location : lambda$mousePressed$0
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

2.2
Location : lambda$mousePressed$0
Killed by : none
removed call to javax/swing/JPopupMenu::setLocation → NO_COVERAGE

3.3
Location : lambda$mousePressed$0
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

158

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JLabel::setText → NO_COVERAGE

159

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JLabel::addMouseListener → NO_COVERAGE

165

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/panel/address/PanelTrailingAddress::setCursor → NO_COVERAGE

166

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JProgressBar::setVisible → NO_COVERAGE

170

1.1
Location : endPreparation
Killed by : none
removed call to com/jsql/view/swing/panel/address/ButtonStart::setToolTipText → NO_COVERAGE

171

1.1
Location : endPreparation
Killed by : none
removed call to com/jsql/view/swing/panel/address/ButtonStart::setInjectionReady → NO_COVERAGE

172

1.1
Location : endPreparation
Killed by : none
removed call to javax/swing/JProgressBar::setVisible → NO_COVERAGE

176

1.1
Location : reset
Killed by : none
removed call to javax/swing/JLabel::setText → NO_COVERAGE

177

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

178

1.1
Location : reset
Killed by : none
removed call to javax/swing/JLabel::setText → NO_COVERAGE

181

1.1
Location : reset
Killed by : none
removed call to java/util/stream/Stream::forEach → NO_COVERAGE

2.2
Location : lambda$reset$2
Killed by : none
removed call to java/awt/Component::setEnabled → NO_COVERAGE

182

1.1
Location : reset
Killed by : none
removed call to javax/swing/JMenu::removeAll → NO_COVERAGE

184

1.1
Location : reset
Killed by : none
removed call to javax/swing/ButtonGroup::clearSelection → NO_COVERAGE

185

1.1
Location : lambda$reset$3
Killed by : none
replaced return value with null for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$reset$3 → NO_COVERAGE

187

1.1
Location : lambda$reset$4
Killed by : none
replaced boolean return with false for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$reset$4 → NO_COVERAGE

2.2
Location : lambda$reset$4
Killed by : none
replaced boolean return with true for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$reset$4 → NO_COVERAGE

188

1.1
Location : reset
Killed by : none
removed call to java/util/stream/Stream::forEach → NO_COVERAGE

192

1.1
Location : setEngine
Killed by : none
removed call to javax/swing/JLabel::setText → NO_COVERAGE

193

1.1
Location : setEngine
Killed by : none
removed call to javax/swing/JMenu::removeAll → NO_COVERAGE

196

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

197

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

201

1.1
Location : setEngine
Killed by : none
removed call to javax/swing/JMenuItem::setEnabled → NO_COVERAGE

202

1.1
Location : setEngine
Killed by : none
removed call to javax/swing/JMenuItem::setName → NO_COVERAGE

204

1.1
Location : setEngine
Killed by : none
removed call to javax/swing/ButtonGroup::add → NO_COVERAGE

206

1.1
Location : setEngine
Killed by : none
removed call to javax/swing/JMenuItem::addActionListener → NO_COVERAGE

207

1.1
Location : lambda$setEngine$5
Killed by : none
removed call to javax/swing/JLabel::setText → NO_COVERAGE

208

1.1
Location : lambda$setEngine$5
Killed by : none
removed call to com/jsql/model/injection/strategy/MediatorStrategy::setStrategy → NO_COVERAGE

209

1.1
Location : lambda$setEngine$5
Killed by : none
removed call to com/jsql/model/injection/strategy/StrategyError::setIndexErrorStrategy → NO_COVERAGE

211

1.1
Location : setEngine
Killed by : none
Changed increment from 1 to -1 → NO_COVERAGE

217

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

218

1.1
Location : activateStrategy
Killed by : none
removed call to javax/swing/JLabel::setText → NO_COVERAGE

226

1.1
Location : lambda$activateStrategy$6
Killed by : none
replaced boolean return with true for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$activateStrategy$6 → NO_COVERAGE

2.2
Location : lambda$activateStrategy$6
Killed by : none
replaced boolean return with false for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$activateStrategy$6 → NO_COVERAGE

227

1.1
Location : activateStrategy
Killed by : none
removed call to java/util/stream/Stream::forEach → NO_COVERAGE

228

1.1
Location : lambda$activateStrategy$7
Killed by : none
removed call to javax/swing/JRadioButtonMenuItem::setSelected → NO_COVERAGE

229

1.1
Location : lambda$activateStrategy$7
Killed by : none
removed call to javax/swing/JLabel::setText → NO_COVERAGE

232

1.1
Location : activateStrategy
Killed by : none
removed call to javax/swing/JLabel::setText → NO_COVERAGE

235

1.1
Location : lambda$activateStrategy$8
Killed by : none
replaced boolean return with false for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$activateStrategy$8 → NO_COVERAGE

2.2
Location : lambda$activateStrategy$8
Killed by : none
replaced boolean return with true for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$activateStrategy$8 → NO_COVERAGE

236

1.1
Location : lambda$activateStrategy$9
Killed by : none
removed call to javax/swing/JMenuItem::setSelected → NO_COVERAGE

2.2
Location : activateStrategy
Killed by : none
removed call to java/util/stream/Stream::forEach → NO_COVERAGE

243

1.1
Location : lambda$markInvulnerable$10
Killed by : none
replaced boolean return with true for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$markInvulnerable$10 → NO_COVERAGE

2.2
Location : lambda$markInvulnerable$10
Killed by : none
replaced boolean return with false for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$markInvulnerable$10 → NO_COVERAGE

244

1.1
Location : markInvulnerable
Killed by : none
removed call to java/util/stream/Stream::forEach → NO_COVERAGE

2.2
Location : lambda$markInvulnerable$11
Killed by : none
removed call to javax/swing/JMenuItem::setEnabled → NO_COVERAGE

250

1.1
Location : lambda$markInvulnerable$12
Killed by : none
replaced boolean return with false for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$markInvulnerable$12 → NO_COVERAGE

2.2
Location : lambda$markInvulnerable$12
Killed by : none
replaced boolean return with true for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$markInvulnerable$12 → NO_COVERAGE

258

1.1
Location : lambda$markInvulnerable$13
Killed by : none
negated conditional → NO_COVERAGE

261

1.1
Location : lambda$markInvulnerable$13
Killed by : none
replaced boolean return with true for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$markInvulnerable$13 → NO_COVERAGE

263

1.1
Location : lambda$markInvulnerable$13
Killed by : none
replaced boolean return with false for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$markInvulnerable$13 → NO_COVERAGE

2.2
Location : lambda$markInvulnerable$13
Killed by : none
replaced boolean return with true for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$markInvulnerable$13 → NO_COVERAGE

265

1.1
Location : lambda$markInvulnerable$14
Killed by : none
removed call to javax/swing/JMenuItem::setEnabled → NO_COVERAGE

2.2
Location : markInvulnerable
Killed by : none
removed call to java/util/stream/Stream::forEach → NO_COVERAGE

270

1.1
Location : getMenuError
Killed by : none
replaced return value with null for com/jsql/view/swing/panel/address/PanelTrailingAddress::getMenuError → NO_COVERAGE

272

1.1
Location : lambda$getMenuError$15
Killed by : none
replaced boolean return with true for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$getMenuError$15 → NO_COVERAGE

2.2
Location : lambda$getMenuError$15
Killed by : none
replaced boolean return with false for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$getMenuError$15 → NO_COVERAGE

280

1.1
Location : lambda$markVulnerable$16
Killed by : none
replaced boolean return with false for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$markVulnerable$16 → NO_COVERAGE

2.2
Location : lambda$markVulnerable$16
Killed by : none
replaced boolean return with true for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$markVulnerable$16 → NO_COVERAGE

281

1.1
Location : lambda$markVulnerable$17
Killed by : none
removed call to javax/swing/JMenuItem::setEnabled → NO_COVERAGE

2.2
Location : markVulnerable
Killed by : none
removed call to java/util/stream/Stream::forEach → NO_COVERAGE

289

1.1
Location : lambda$markVulnerable$18
Killed by : none
replaced boolean return with true for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$markVulnerable$18 → NO_COVERAGE

2.2
Location : lambda$markVulnerable$18
Killed by : none
replaced boolean return with false for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$markVulnerable$18 → NO_COVERAGE

291

1.1
Location : lambda$markVulnerable$19
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : lambda$markVulnerable$19
Killed by : none
replaced boolean return with true for com/jsql/view/swing/panel/address/PanelTrailingAddress::lambda$markVulnerable$19 → NO_COVERAGE

292

1.1
Location : markVulnerable
Killed by : none
removed call to java/util/stream/Stream::forEach → NO_COVERAGE

293

1.1
Location : lambda$markVulnerable$20
Killed by : none
removed call to javax/swing/JMenu::setEnabled → NO_COVERAGE

294

1.1
Location : lambda$markVulnerable$20
Killed by : none
removed call to javax/swing/JMenuItem::setEnabled → NO_COVERAGE

305

1.1
Location : getLoader
Killed by : none
replaced return value with null for com/jsql/view/swing/panel/address/PanelTrailingAddress::getLoader → NO_COVERAGE

309

1.1
Location : getButtonStart
Killed by : none
replaced return value with null for com/jsql/view/swing/panel/address/PanelTrailingAddress::getButtonStart → NO_COVERAGE

313

1.1
Location : getLabelTarget
Killed by : none
replaced return value with null for com/jsql/view/swing/panel/address/PanelTrailingAddress::getLabelTarget → NO_COVERAGE

317

1.1
Location : getGroupRadio
Killed by : none
replaced return value with null for com/jsql/view/swing/panel/address/PanelTrailingAddress::getGroupRadio → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.23.0