1 | /** | |
2 | Copyright 2017 Carlos Macasaet | |
3 | ||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | |
5 | you may not use this file except in compliance with the License. | |
6 | You may obtain a copy of the License at | |
7 | ||
8 | http://www.apache.org/licenses/LICENSE-2.0 | |
9 | ||
10 | Unless required by applicable law or agreed to in writing, software | |
11 | distributed under the License is distributed on an "AS IS" BASIS, | |
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | See the License for the specific language governing permissions and | |
14 | limitations under the License. | |
15 | */ | |
16 | package com.macasaet.fernet; | |
17 | ||
18 | import static com.macasaet.fernet.Constants.charset; | |
19 | ||
20 | import java.nio.charset.Charset; | |
21 | import java.util.function.Function; | |
22 | ||
23 | /** | |
24 | * A {@link Validator} for String payloads. This is useful if your | |
25 | * payload contains unique identifiers like user names. If the payload | |
26 | * is a structured String like JSON or XML, use {@link Validator} or | |
27 | * {@link StringObjectValidator} instead. | |
28 | * | |
29 | * <p>Copyright © 2017 Carlos Macasaet.</p> | |
30 | * | |
31 | * @author Carlos Macasaet | |
32 | */ | |
33 | public interface StringValidator extends Validator<String> { | |
34 | ||
35 | default Charset getCharset() { | |
36 |
1
1. getCharset : mutated return of Object value for com/macasaet/fernet/StringValidator::getCharset to ( if (x != null) null else throw new RuntimeException ) → KILLED |
return charset; |
37 | } | |
38 | ||
39 | default Function<byte[], String> getTransformer() { | |
40 |
1
1. getTransformer : mutated return of Object value for com/macasaet/fernet/StringValidator::getTransformer to ( if (x != null) null else throw new RuntimeException ) → KILLED |
return bytes -> { |
41 | final String retval = new String(bytes, getCharset()); | |
42 |
3
1. lambda$getTransformer$0 : changed conditional boundary → SURVIVED 2. lambda$getTransformer$0 : Changed increment from -1 to 1 → KILLED 3. lambda$getTransformer$0 : negated conditional → KILLED |
for (int i = bytes.length; --i >= 0; bytes[i] = 0); |
43 |
1
1. lambda$getTransformer$0 : mutated return of Object value for com/macasaet/fernet/StringValidator::lambda$getTransformer$0 to ( if (x != null) null else throw new RuntimeException ) → KILLED |
return retval; |
44 | }; | |
45 | } | |
46 | ||
47 | } | |
Mutations | ||
36 |
1.1 |
|
40 |
1.1 |
|
42 |
1.1 2.2 3.3 |
|
43 |
1.1 |