ActionCoder.java

1
package com.jsql.util.bruter;
2
3
import com.jsql.util.StringUtil;
4
import org.apache.commons.codec.DecoderException;
5
import org.apache.commons.lang3.StringUtils;
6
import org.apache.commons.text.StringEscapeUtils;
7
8
import java.io.IOException;
9
import java.security.NoSuchAlgorithmException;
10
import java.util.Arrays;
11
import java.util.Optional;
12
13
public enum ActionCoder {
14
15
    MD2("Md2") {
16
        @Override
17
        public String run(String value) throws NoSuchAlgorithmException {
18 1 1. run : replaced return value with "" for com/jsql/util/bruter/ActionCoder$1::run → NO_COVERAGE
            return HashUtil.toHash(this.name, value);
19
        }
20
    },
21
    
22
    MD4("Md4") {
23
        @Override
24
        public String run(String value) {
25 1 1. run : replaced return value with "" for com/jsql/util/bruter/ActionCoder$2::run → NO_COVERAGE
            return HashUtil.toMd4(value);
26
        }
27
    },
28
    
29
    MD5("Md5") {
30
        @Override
31
        public String run(String value) throws NoSuchAlgorithmException {
32 1 1. run : replaced return value with "" for com/jsql/util/bruter/ActionCoder$3::run → NO_COVERAGE
            return HashUtil.toHash(this.name, value);
33
        }
34
    },
35
    
36
    SHA_1("Sha-1") {
37
        @Override
38
        public String run(String value) throws NoSuchAlgorithmException {
39 1 1. run : replaced return value with "" for com/jsql/util/bruter/ActionCoder$4::run → NO_COVERAGE
            return HashUtil.toHash(this.name, value);
40
        }
41
    },
42
    
43
    SHA_256("Sha-256") {
44
        @Override
45
        public String run(String value) throws NoSuchAlgorithmException {
46 1 1. run : replaced return value with "" for com/jsql/util/bruter/ActionCoder$5::run → NO_COVERAGE
            return HashUtil.toHash(this.name, value);
47
        }
48
    },
49
    
50
    SHA_384("Sha-384") {
51
        @Override
52
        public String run(String value) throws NoSuchAlgorithmException {
53 1 1. run : replaced return value with "" for com/jsql/util/bruter/ActionCoder$6::run → NO_COVERAGE
            return HashUtil.toHash(this.name, value);
54
        }
55
    },
56
    
57
    SHA_512("Sha-512") {
58
        @Override
59
        public String run(String value) throws NoSuchAlgorithmException {
60 1 1. run : replaced return value with "" for com/jsql/util/bruter/ActionCoder$7::run → NO_COVERAGE
            return HashUtil.toHash(this.name, value);
61
        }
62
    },
63
    
64
    MYSQL("Mysql") {
65
        @Override
66
        public String run(String value) throws NoSuchAlgorithmException {
67 1 1. run : replaced return value with "" for com/jsql/util/bruter/ActionCoder$8::run → NO_COVERAGE
            return HashUtil.toMySql(value);
68
        }
69
    },
70
    
71
    ADLER32("Adler32") {
72
        @Override
73
        public String run(String value) {
74 1 1. run : replaced return value with "" for com/jsql/util/bruter/ActionCoder$9::run → NO_COVERAGE
            return HashUtil.toAdler32(value);
75
        }
76
    },
77
    
78
    CRC16("Crc16") {
79
        @Override
80
        public String run(String value) {
81 1 1. run : replaced return value with "" for com/jsql/util/bruter/ActionCoder$10::run → NO_COVERAGE
            return HashUtil.toCrc16(value);
82
        }
83
    },
84
    
85
    CRC32("Crc32") {
86
        @Override
87
        public String run(String value) {
88 1 1. run : replaced return value with "" for com/jsql/util/bruter/ActionCoder$11::run → NO_COVERAGE
            return HashUtil.toCrc32(value);
89
        }
90
    },
91
    
92
    CRC64("Crc64") {
93
        @Override
94
        public String run(String value) {
95 1 1. run : replaced return value with "" for com/jsql/util/bruter/ActionCoder$12::run → NO_COVERAGE
            return HashUtil.toCrc64(value);
96
        }
97
    },
98
    
99
    ENCODE_TO_HEX("Encode to Hex") {
100
        @Override
101
        public String run(String value) {
102 1 1. run : replaced return value with "" for com/jsql/util/bruter/ActionCoder$13::run → NO_COVERAGE
            return StringUtil.toHex(value);
103
        }
104
    },
105
    
106
    ENCODE_TO_HEX_ZIPPED("Encode to Hex(zipped)") {
107
        @Override
108
        public String run(String value) throws IOException {
109 1 1. run : replaced return value with "" for com/jsql/util/bruter/ActionCoder$14::run → NO_COVERAGE
            return StringUtil.toHexZip(value);
110
        }
111
    },
112
    
113
    ENCODE_TO_BASE64_ZIPPED("Encode to Base64(zipped)") {
114
        @Override
115
        public String run(String value) throws IOException {
116 1 1. run : replaced return value with "" for com/jsql/util/bruter/ActionCoder$15::run → NO_COVERAGE
            return StringUtil.toBase64Zip(value);
117
        }
118
    },
119
    
120
    ENCODE_TO_BASE64("Encode to Base64") {
121
        @Override
122
        public String run(String value) {
123 1 1. run : replaced return value with "" for com/jsql/util/bruter/ActionCoder$16::run → NO_COVERAGE
            return StringUtil.base64Encode(value);
124
        }
125
    },
126
    
127
    ENCODE_TO_BASE32("Encode to Base32") {
128
        @Override
129
        public String run(String value) {
130 1 1. run : replaced return value with "" for com/jsql/util/bruter/ActionCoder$17::run → NO_COVERAGE
            return StringUtil.base32Encode(value);
131
        }
132
    },
133
    
134
    ENCODE_TO_BASE58("Encode to Base58") {
135
        @Override
136
        public String run(String value) {
137 1 1. run : replaced return value with "" for com/jsql/util/bruter/ActionCoder$18::run → NO_COVERAGE
            return StringUtil.base58Encode(value);
138
        }
139
    },
140
    
141
    ENCODE_TO_BASE16("Encode to Base16") {
142
        @Override
143
        public String run(String value) {
144 1 1. run : replaced return value with "" for com/jsql/util/bruter/ActionCoder$19::run → NO_COVERAGE
            return StringUtil.base16Encode(value);
145
        }
146
    },
147
    
148
    ENCODE_TO_HTML("Encode to Html") {
149
        @Override
150
        public String run(String value) {
151 1 1. run : replaced return value with "" for com/jsql/util/bruter/ActionCoder$20::run → NO_COVERAGE
            return StringUtil.toHtml(value);
152
        }
153
    },
154
    
155
    ENCODE_TO_HTML_DECIMAL("Encode to Html (decimal)") {
156
        @Override
157
        public String run(String value) {
158 1 1. run : replaced return value with "" for com/jsql/util/bruter/ActionCoder$21::run → NO_COVERAGE
            return StringUtil.decimalHtmlEncode(value, true);
159
        }
160
    },
161
    
162
    ENCODE_TO_URL("Encode to Url") {
163
        @Override
164
        public String run(String value) {
165 1 1. run : replaced return value with "" for com/jsql/util/bruter/ActionCoder$22::run → NO_COVERAGE
            return StringUtil.toUrl(value);
166
        }
167
    },
168
    
169
    ENCODE_TO_UNICODE("Encode to Unicode") {
170
        @Override
171
        public String run(String value) {
172 1 1. run : replaced return value with "" for com/jsql/util/bruter/ActionCoder$23::run → NO_COVERAGE
            return StringEscapeUtils.escapeJava(value);
173
        }
174
    },
175
176
    DECODE_FROM_HEX("Decode from Hex") {
177
        @Override
178
        public String run(String value) throws DecoderException {
179 1 1. run : replaced return value with "" for com/jsql/util/bruter/ActionCoder$24::run → NO_COVERAGE
            return StringUtil.fromHex(value);
180
        }
181
    },
182
    
183
    DECODE_FROM_HEX_ZIPPED("Decode from Hex(zipped)") {
184
        @Override
185
        public String run(String value) throws IOException, DecoderException {
186 1 1. run : replaced return value with "" for com/jsql/util/bruter/ActionCoder$25::run → NO_COVERAGE
            return StringUtil.fromHexZip(value);
187
        }
188
    },
189
    
190
    DECODE_FROM_BASE64_ZIPPED("Decode from Base64(zipped)") {
191
        @Override
192
        public String run(String value) throws IOException {
193 1 1. run : replaced return value with "" for com/jsql/util/bruter/ActionCoder$26::run → NO_COVERAGE
            return StringUtil.fromBase64Zip(value);
194
        }
195
    },
196
    
197
    DECODE_FROM_BASE64("Decode from Base64") {
198
        @Override
199
        public String run(String value) {
200 1 1. run : replaced return value with "" for com/jsql/util/bruter/ActionCoder$27::run → NO_COVERAGE
            return StringUtil.base64Decode(value);
201
        }
202
    },
203
    
204
    DECODE_FROM_BASE32("Decode from Base32") {
205
        @Override
206
        public String run(String value) {
207 1 1. run : replaced return value with "" for com/jsql/util/bruter/ActionCoder$28::run → NO_COVERAGE
            return StringUtil.base32Decode(value);
208
        }
209
    },
210
    
211
    DECODE_FROM_BASE58("Decode from Base58") {
212
        @Override
213
        public String run(String value) {
214 1 1. run : replaced return value with "" for com/jsql/util/bruter/ActionCoder$29::run → NO_COVERAGE
            return StringUtil.base58Decode(value);
215
        }
216
    },
217
    
218
    DECODE_FROM_BASE16("Decode from Base16") {
219
        @Override
220
        public String run(String value) {
221 1 1. run : replaced return value with "" for com/jsql/util/bruter/ActionCoder$30::run → NO_COVERAGE
            return StringUtil.base16Decode(value);
222
        }
223
    },
224
    
225
    DECODE_FROM_HTML("Decode from Html") {
226
        @Override
227
        public String run(String value) {
228 1 1. run : replaced return value with "" for com/jsql/util/bruter/ActionCoder$31::run → NO_COVERAGE
            return StringUtil.fromHtml(value);
229
        }
230
    },
231
    
232
    DECODE_FROM_UNICODE("Decode from Unicode") {
233
        @Override
234
        public String run(String value) {
235 1 1. run : replaced return value with "" for com/jsql/util/bruter/ActionCoder$32::run → NO_COVERAGE
            return StringEscapeUtils.unescapeJava(value);
236
        }
237
    },
238
    
239
    DECODE_FROM_URL("Decode from Url") {
240
        @Override
241
        public String run(String value) {
242 1 1. run : replaced return value with "" for com/jsql/util/bruter/ActionCoder$33::run → NO_COVERAGE
            return StringUtils.replaceEach(
243
                StringUtil.fromUrl(value),
244
                new String[] { "&", "\"", "<", ">" },
245
                new String[] { "&amp;", "&quot;", "&lt;", "&gt;" }
246
            );
247
        }
248
    };
249
250
    protected final String name;
251
252
    ActionCoder(String name) {
253
        this.name = name;
254
    }
255
256
    public static Optional<ActionCoder> forName(String name) {
257 1 1. forName : replaced return value with Optional.empty for com/jsql/util/bruter/ActionCoder::forName → NO_COVERAGE
        return Arrays.stream(ActionCoder.values())
258 2 1. lambda$forName$0 : replaced boolean return with false for com/jsql/util/bruter/ActionCoder::lambda$forName$0 → NO_COVERAGE
2. lambda$forName$0 : replaced boolean return with true for com/jsql/util/bruter/ActionCoder::lambda$forName$0 → NO_COVERAGE
            .filter(action -> name.equals(action.name))
259
            .findFirst();
260
    }
261
262
    public abstract String run(String value) throws DecoderException, IOException, NoSuchAlgorithmException;
263
}

Mutations

18

1.1
Location : run
Killed by : none
replaced return value with "" for com/jsql/util/bruter/ActionCoder$1::run → NO_COVERAGE

25

1.1
Location : run
Killed by : none
replaced return value with "" for com/jsql/util/bruter/ActionCoder$2::run → NO_COVERAGE

32

1.1
Location : run
Killed by : none
replaced return value with "" for com/jsql/util/bruter/ActionCoder$3::run → NO_COVERAGE

39

1.1
Location : run
Killed by : none
replaced return value with "" for com/jsql/util/bruter/ActionCoder$4::run → NO_COVERAGE

46

1.1
Location : run
Killed by : none
replaced return value with "" for com/jsql/util/bruter/ActionCoder$5::run → NO_COVERAGE

53

1.1
Location : run
Killed by : none
replaced return value with "" for com/jsql/util/bruter/ActionCoder$6::run → NO_COVERAGE

60

1.1
Location : run
Killed by : none
replaced return value with "" for com/jsql/util/bruter/ActionCoder$7::run → NO_COVERAGE

67

1.1
Location : run
Killed by : none
replaced return value with "" for com/jsql/util/bruter/ActionCoder$8::run → NO_COVERAGE

74

1.1
Location : run
Killed by : none
replaced return value with "" for com/jsql/util/bruter/ActionCoder$9::run → NO_COVERAGE

81

1.1
Location : run
Killed by : none
replaced return value with "" for com/jsql/util/bruter/ActionCoder$10::run → NO_COVERAGE

88

1.1
Location : run
Killed by : none
replaced return value with "" for com/jsql/util/bruter/ActionCoder$11::run → NO_COVERAGE

95

1.1
Location : run
Killed by : none
replaced return value with "" for com/jsql/util/bruter/ActionCoder$12::run → NO_COVERAGE

102

1.1
Location : run
Killed by : none
replaced return value with "" for com/jsql/util/bruter/ActionCoder$13::run → NO_COVERAGE

109

1.1
Location : run
Killed by : none
replaced return value with "" for com/jsql/util/bruter/ActionCoder$14::run → NO_COVERAGE

116

1.1
Location : run
Killed by : none
replaced return value with "" for com/jsql/util/bruter/ActionCoder$15::run → NO_COVERAGE

123

1.1
Location : run
Killed by : none
replaced return value with "" for com/jsql/util/bruter/ActionCoder$16::run → NO_COVERAGE

130

1.1
Location : run
Killed by : none
replaced return value with "" for com/jsql/util/bruter/ActionCoder$17::run → NO_COVERAGE

137

1.1
Location : run
Killed by : none
replaced return value with "" for com/jsql/util/bruter/ActionCoder$18::run → NO_COVERAGE

144

1.1
Location : run
Killed by : none
replaced return value with "" for com/jsql/util/bruter/ActionCoder$19::run → NO_COVERAGE

151

1.1
Location : run
Killed by : none
replaced return value with "" for com/jsql/util/bruter/ActionCoder$20::run → NO_COVERAGE

158

1.1
Location : run
Killed by : none
replaced return value with "" for com/jsql/util/bruter/ActionCoder$21::run → NO_COVERAGE

165

1.1
Location : run
Killed by : none
replaced return value with "" for com/jsql/util/bruter/ActionCoder$22::run → NO_COVERAGE

172

1.1
Location : run
Killed by : none
replaced return value with "" for com/jsql/util/bruter/ActionCoder$23::run → NO_COVERAGE

179

1.1
Location : run
Killed by : none
replaced return value with "" for com/jsql/util/bruter/ActionCoder$24::run → NO_COVERAGE

186

1.1
Location : run
Killed by : none
replaced return value with "" for com/jsql/util/bruter/ActionCoder$25::run → NO_COVERAGE

193

1.1
Location : run
Killed by : none
replaced return value with "" for com/jsql/util/bruter/ActionCoder$26::run → NO_COVERAGE

200

1.1
Location : run
Killed by : none
replaced return value with "" for com/jsql/util/bruter/ActionCoder$27::run → NO_COVERAGE

207

1.1
Location : run
Killed by : none
replaced return value with "" for com/jsql/util/bruter/ActionCoder$28::run → NO_COVERAGE

214

1.1
Location : run
Killed by : none
replaced return value with "" for com/jsql/util/bruter/ActionCoder$29::run → NO_COVERAGE

221

1.1
Location : run
Killed by : none
replaced return value with "" for com/jsql/util/bruter/ActionCoder$30::run → NO_COVERAGE

228

1.1
Location : run
Killed by : none
replaced return value with "" for com/jsql/util/bruter/ActionCoder$31::run → NO_COVERAGE

235

1.1
Location : run
Killed by : none
replaced return value with "" for com/jsql/util/bruter/ActionCoder$32::run → NO_COVERAGE

242

1.1
Location : run
Killed by : none
replaced return value with "" for com/jsql/util/bruter/ActionCoder$33::run → NO_COVERAGE

257

1.1
Location : forName
Killed by : none
replaced return value with Optional.empty for com/jsql/util/bruter/ActionCoder::forName → NO_COVERAGE

258

1.1
Location : lambda$forName$0
Killed by : none
replaced boolean return with false for com/jsql/util/bruter/ActionCoder::lambda$forName$0 → NO_COVERAGE

2.2
Location : lambda$forName$0
Killed by : none
replaced boolean return with true for com/jsql/util/bruter/ActionCoder::lambda$forName$0 → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.16.1