PanelPreferences.java

1
package com.jsql.view.swing.panel;
2
3
import com.jsql.util.I18nUtil;
4
import com.jsql.view.swing.panel.preferences.*;
5
import com.jsql.view.swing.panel.preferences.listener.ActionListenerSave;
6
import com.jsql.view.swing.util.MediatorHelper;
7
import com.jsql.view.swing.util.UiUtil;
8
import org.apache.commons.text.WordUtils;
9
10
import javax.swing.*;
11
import java.awt.*;
12
import java.awt.event.ActionListener;
13
14
public class PanelPreferences extends JPanel {
15
    
16
    private final transient ActionListener actionListenerSave = new ActionListenerSave(this);
17
    
18
    private final PanelConnection panelConnection = new PanelConnection(this);
19
    private final PanelStrategies panelStrategies = new PanelStrategies(this);
20
    private final PanelInjection panelInjection = new PanelInjection(this);
21
    private final PanelTampering panelTampering = new PanelTampering(this);
22
    private final PanelUserAgent panelUserAgent = new PanelUserAgent(this);
23
    private final PanelAuthentication panelAuthentication = new PanelAuthentication(this);
24
    private final PanelProxy panelProxy = new PanelProxy(this);
25
    private final PanelGeneral panelGeneral = new PanelGeneral(this);
26
27
    private enum CategoryPreference {
28
        CONNECTION,
29
        STRATEGIES,
30
        INJECTION,
31
        TAMPERING,
32
        EXPLOIT,
33
        USER_AGENT,
34
        AUTHENTICATION,
35
        PROXY,
36
        GENERAL;
37
38
        @Override
39
        public String toString() {
40 1 1. toString : replaced return value with "" for com/jsql/view/swing/panel/PanelPreferences$CategoryPreference::toString → NO_COVERAGE
            return "  "+ WordUtils.capitalizeFully(this.name()).replace('_', ' ') +"  ";
41
        }
42
    }
43
    
44
    public PanelPreferences() {
45 1 1. <init> : removed call to com/jsql/view/swing/panel/PanelPreferences::setLayout → NO_COVERAGE
        this.setLayout(new BorderLayout());
46 1 1. <init> : removed call to com/jsql/view/swing/panel/PanelPreferences::setBorder → NO_COVERAGE
        this.setBorder(UiUtil.BORDER_5PX);
47
48
        var cards = new JPanel(new CardLayout());
49 1 1. <init> : removed call to javax/swing/JPanel::setMinimumSize → NO_COVERAGE
        cards.setMinimumSize(new Dimension(0, 0));  // required
50
51
        JList<CategoryPreference> categories = PanelPreferences.getCategories(cards);
52 1 1. <init> : removed call to com/jsql/view/swing/panel/PanelPreferences::add → NO_COVERAGE
        this.add(categories, BorderLayout.LINE_START);
53
54 1 1. <init> : removed call to com/jsql/view/swing/panel/PanelPreferences::addToCard → NO_COVERAGE
        this.addToCard(cards, this.panelConnection, CategoryPreference.CONNECTION);
55 1 1. <init> : removed call to com/jsql/view/swing/panel/PanelPreferences::addToCard → NO_COVERAGE
        this.addToCard(cards, this.panelStrategies, CategoryPreference.STRATEGIES);
56 1 1. <init> : removed call to com/jsql/view/swing/panel/PanelPreferences::addToCard → NO_COVERAGE
        this.addToCard(cards, this.panelInjection, CategoryPreference.INJECTION);
57 1 1. <init> : removed call to com/jsql/view/swing/panel/PanelPreferences::addToCard → NO_COVERAGE
        this.addToCard(cards, this.panelTampering, CategoryPreference.TAMPERING);
58 1 1. <init> : removed call to com/jsql/view/swing/panel/PanelPreferences::addToCard → NO_COVERAGE
        this.addToCard(cards, new PanelExploit(), CategoryPreference.EXPLOIT);
59 1 1. <init> : removed call to com/jsql/view/swing/panel/PanelPreferences::addToCard → NO_COVERAGE
        this.addToCard(cards, this.panelUserAgent, CategoryPreference.USER_AGENT);
60 1 1. <init> : removed call to com/jsql/view/swing/panel/PanelPreferences::addToCard → NO_COVERAGE
        this.addToCard(cards, this.panelAuthentication, CategoryPreference.AUTHENTICATION);
61 1 1. <init> : removed call to com/jsql/view/swing/panel/PanelPreferences::addToCard → NO_COVERAGE
        this.addToCard(cards, this.panelProxy, CategoryPreference.PROXY);
62 1 1. <init> : removed call to com/jsql/view/swing/panel/PanelPreferences::addToCard → NO_COVERAGE
        this.addToCard(cards, this.panelGeneral, CategoryPreference.GENERAL);
63 1 1. <init> : removed call to com/jsql/view/swing/panel/PanelPreferences::add → NO_COVERAGE
        this.add(cards, BorderLayout.CENTER);
64
65 2 1. <init> : removed call to javax/swing/SwingUtilities::invokeLater → NO_COVERAGE
2. lambda$new$0 : removed call to com/jsql/view/swing/menubar/AppMenubar::switchLocale → NO_COVERAGE
        SwingUtilities.invokeLater(() -> MediatorHelper.menubar().switchLocale(I18nUtil.getCurrentLocale()));  // required for arabic
66
    }
67
68
    private static JList<CategoryPreference> getCategories(JPanel cards) {
69
        JList<CategoryPreference> categories = new JList<>(CategoryPreference.values());
70 1 1. getCategories : removed call to javax/swing/JList::setMinimumSize → NO_COVERAGE
        categories.setMinimumSize(new Dimension(0, 0));
71 1 1. getCategories : removed call to javax/swing/JList::setName → NO_COVERAGE
        categories.setName("listCategoriesPreference");
72 1 1. getCategories : removed call to javax/swing/JList::setSelectionMode → NO_COVERAGE
        categories.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
73 1 1. getCategories : removed call to javax/swing/JList::setSelectedIndex → NO_COVERAGE
        categories.setSelectedIndex(0);
74 1 1. getCategories : removed call to javax/swing/JList::addListSelectionListener → NO_COVERAGE
        categories.addListSelectionListener(e -> {
75
            CardLayout cardLayout = (CardLayout) cards.getLayout();
76 1 1. lambda$getCategories$1 : removed call to java/awt/CardLayout::show → NO_COVERAGE
            cardLayout.show(cards, categories.getSelectedValue().name());
77
        });
78 1 1. getCategories : replaced return value with null for com/jsql/view/swing/panel/PanelPreferences::getCategories → NO_COVERAGE
        return categories;
79
    }
80
81
    private void addToCard(JPanel cards, JPanel panel, CategoryPreference category) {
82 1 1. addToCard : removed call to javax/swing/JPanel::setBorder → NO_COVERAGE
        panel.setBorder(BorderFactory.createEmptyBorder(10, 15, 10, 15));
83
        var scrollPane = new JScrollPane(panel);
84 1 1. addToCard : removed call to javax/swing/JScrollPane::setBorder → NO_COVERAGE
        scrollPane.setBorder(BorderFactory.createEmptyBorder());  // required to hide border
85 1 1. addToCard : removed call to javax/swing/JScrollBar::setUnitIncrement → NO_COVERAGE
        scrollPane.getVerticalScrollBar().setUnitIncrement(16);
86 1 1. addToCard : removed call to javax/swing/JScrollBar::setUnitIncrement → NO_COVERAGE
        scrollPane.getHorizontalScrollBar().setUnitIncrement(16);
87 1 1. addToCard : removed call to javax/swing/JPanel::add → NO_COVERAGE
        cards.add(scrollPane, category.name());
88
    }
89
90
    
91
    // Getter and setter
92
93
    public PanelAuthentication getPanelAuthentication() {
94 1 1. getPanelAuthentication : replaced return value with null for com/jsql/view/swing/panel/PanelPreferences::getPanelAuthentication → NO_COVERAGE
        return this.panelAuthentication;
95
    }
96
97
    public PanelProxy getPanelProxy() {
98 1 1. getPanelProxy : replaced return value with null for com/jsql/view/swing/panel/PanelPreferences::getPanelProxy → NO_COVERAGE
        return this.panelProxy;
99
    }
100
101
    public PanelInjection getPanelInjection() {
102 1 1. getPanelInjection : replaced return value with null for com/jsql/view/swing/panel/PanelPreferences::getPanelInjection → NO_COVERAGE
        return this.panelInjection;
103
    }
104
105
    public PanelTampering getPanelTampering() {
106 1 1. getPanelTampering : replaced return value with null for com/jsql/view/swing/panel/PanelPreferences::getPanelTampering → NO_COVERAGE
        return this.panelTampering;
107
    }
108
109
    public PanelGeneral getPanelGeneral() {
110 1 1. getPanelGeneral : replaced return value with null for com/jsql/view/swing/panel/PanelPreferences::getPanelGeneral → NO_COVERAGE
        return this.panelGeneral;
111
    }
112
    
113
    public PanelConnection getPanelConnection() {
114 1 1. getPanelConnection : replaced return value with null for com/jsql/view/swing/panel/PanelPreferences::getPanelConnection → NO_COVERAGE
        return this.panelConnection;
115
    }
116
117
    public PanelStrategies getPanelStrategies() {
118 1 1. getPanelStrategies : replaced return value with null for com/jsql/view/swing/panel/PanelPreferences::getPanelStrategies → NO_COVERAGE
        return this.panelStrategies;
119
    }
120
121
    public PanelUserAgent getPanelUserAgent() {
122 1 1. getPanelUserAgent : replaced return value with null for com/jsql/view/swing/panel/PanelPreferences::getPanelUserAgent → NO_COVERAGE
        return this.panelUserAgent;
123
    }
124
125
    public ActionListener getActionListenerSave() {
126 1 1. getActionListenerSave : replaced return value with null for com/jsql/view/swing/panel/PanelPreferences::getActionListenerSave → NO_COVERAGE
        return this.actionListenerSave;
127
    }
128
}

Mutations

40

1.1
Location : toString
Killed by : none
replaced return value with "" for com/jsql/view/swing/panel/PanelPreferences$CategoryPreference::toString → NO_COVERAGE

45

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

46

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

49

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

52

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

54

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

55

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

56

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

57

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

58

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

59

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

60

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

61

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

62

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

63

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

65

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

2.2
Location : lambda$new$0
Killed by : none
removed call to com/jsql/view/swing/menubar/AppMenubar::switchLocale → NO_COVERAGE

70

1.1
Location : getCategories
Killed by : none
removed call to javax/swing/JList::setMinimumSize → NO_COVERAGE

71

1.1
Location : getCategories
Killed by : none
removed call to javax/swing/JList::setName → NO_COVERAGE

72

1.1
Location : getCategories
Killed by : none
removed call to javax/swing/JList::setSelectionMode → NO_COVERAGE

73

1.1
Location : getCategories
Killed by : none
removed call to javax/swing/JList::setSelectedIndex → NO_COVERAGE

74

1.1
Location : getCategories
Killed by : none
removed call to javax/swing/JList::addListSelectionListener → NO_COVERAGE

76

1.1
Location : lambda$getCategories$1
Killed by : none
removed call to java/awt/CardLayout::show → NO_COVERAGE

78

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

82

1.1
Location : addToCard
Killed by : none
removed call to javax/swing/JPanel::setBorder → NO_COVERAGE

84

1.1
Location : addToCard
Killed by : none
removed call to javax/swing/JScrollPane::setBorder → NO_COVERAGE

85

1.1
Location : addToCard
Killed by : none
removed call to javax/swing/JScrollBar::setUnitIncrement → NO_COVERAGE

86

1.1
Location : addToCard
Killed by : none
removed call to javax/swing/JScrollBar::setUnitIncrement → NO_COVERAGE

87

1.1
Location : addToCard
Killed by : none
removed call to javax/swing/JPanel::add → NO_COVERAGE

94

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

98

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

102

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

106

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

110

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

114

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

118

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

122

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

126

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

Active mutators

Tests examined


Report generated by PIT 1.19.1