BeanInjection.java

1
package com.jsql.view.swing.list;
2
3
import com.jsql.model.injection.method.AbstractMethodInjection;
4
import com.jsql.model.injection.vendor.model.Vendor;
5
import com.jsql.util.StringUtil;
6
import com.jsql.view.swing.util.MediatorHelper;
7
import org.apache.commons.lang3.StringUtils;
8
9
import java.util.NoSuchElementException;
10
11
public class BeanInjection {
12
    
13
    private final String url;
14
    private String request = StringUtils.EMPTY;
15
    private String header = StringUtils.EMPTY;
16
    private String requestType;
17
    
18
    private AbstractMethodInjection method;
19
    private Vendor vendor;
20
21
    public BeanInjection(String url) {
22
        this.url = url;
23
        this.method = MediatorHelper.model().getMediatorMethod().getQuery();
24
        this.vendor = MediatorHelper.model().getMediatorVendor().getAuto();
25
        this.requestType = StringUtil.GET;
26
    }
27
    
28
    public BeanInjection(String url, String request, String header, String nameMethod, String vendor, String requestType) {
29
        this(url);
30
        this.request = request;
31
        this.header = header;
32
        
33
        try {
34
            this.method = MediatorHelper.model().getMediatorMethod().getMethods().stream()
35 2 1. lambda$new$0 : replaced boolean return with true for com/jsql/view/swing/list/BeanInjection::lambda$new$0 → NO_COVERAGE
2. lambda$new$0 : replaced boolean return with false for com/jsql/view/swing/list/BeanInjection::lambda$new$0 → NO_COVERAGE
                .filter(m -> m.name().equalsIgnoreCase(nameMethod))
36
                .findAny()
37
                .orElse(MediatorHelper.model().getMediatorMethod().getQuery());
38
        } catch (IllegalArgumentException | NoSuchElementException e) {
39
            this.method = MediatorHelper.model().getMediatorMethod().getQuery();
40
        }
41
        
42
        try {
43
            this.vendor = MediatorHelper.model().getMediatorVendor().getVendors().stream()
44 2 1. lambda$new$1 : replaced boolean return with true for com/jsql/view/swing/list/BeanInjection::lambda$new$1 → NO_COVERAGE
2. lambda$new$1 : replaced boolean return with false for com/jsql/view/swing/list/BeanInjection::lambda$new$1 → NO_COVERAGE
                .filter(v -> v.toString().equals(vendor))
45
                .findAny()
46
                .orElse(MediatorHelper.model().getMediatorVendor().getAuto());
47
        } catch (IllegalArgumentException | NoSuchElementException e) {
48
            this.vendor = MediatorHelper.model().getMediatorVendor().getAuto();
49
        }
50
        
51 1 1. <init> : negated conditional → NO_COVERAGE
        this.requestType = requestType.isEmpty() ? StringUtil.GET : requestType;
52
    }
53
    
54
    
55
    // Json getter for serialization
56
    
57
    public String getMethod() {
58 1 1. getMethod : replaced return value with "" for com/jsql/view/swing/list/BeanInjection::getMethod → NO_COVERAGE
        return this.method.name();
59
    }
60
    
61
    public String getVendor() {
62 1 1. getVendor : replaced return value with "" for com/jsql/view/swing/list/BeanInjection::getVendor → NO_COVERAGE
        return this.vendor.toString();
63
    }
64
    
65
    
66
    // Getter and setter
67
68
    public String getUrl() {
69 1 1. getUrl : replaced return value with "" for com/jsql/view/swing/list/BeanInjection::getUrl → NO_COVERAGE
        return this.url;
70
    }
71
72
    public String getRequest() {
73 1 1. getRequest : replaced return value with "" for com/jsql/view/swing/list/BeanInjection::getRequest → NO_COVERAGE
        return this.request;
74
    }
75
76
    public String getHeader() {
77 1 1. getHeader : replaced return value with "" for com/jsql/view/swing/list/BeanInjection::getHeader → NO_COVERAGE
        return this.header;
78
    }
79
    
80
    public String getRequestType() {
81 1 1. getRequestType : replaced return value with "" for com/jsql/view/swing/list/BeanInjection::getRequestType → NO_COVERAGE
        return this.requestType;
82
    }
83
84
    public AbstractMethodInjection getMethodInstance() {
85 1 1. getMethodInstance : replaced return value with null for com/jsql/view/swing/list/BeanInjection::getMethodInstance → NO_COVERAGE
        return this.method;
86
    }
87
}

Mutations

35

1.1
Location : lambda$new$0
Killed by : none
replaced boolean return with true for com/jsql/view/swing/list/BeanInjection::lambda$new$0 → NO_COVERAGE

2.2
Location : lambda$new$0
Killed by : none
replaced boolean return with false for com/jsql/view/swing/list/BeanInjection::lambda$new$0 → NO_COVERAGE

44

1.1
Location : lambda$new$1
Killed by : none
replaced boolean return with true for com/jsql/view/swing/list/BeanInjection::lambda$new$1 → NO_COVERAGE

2.2
Location : lambda$new$1
Killed by : none
replaced boolean return with false for com/jsql/view/swing/list/BeanInjection::lambda$new$1 → NO_COVERAGE

51

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

58

1.1
Location : getMethod
Killed by : none
replaced return value with "" for com/jsql/view/swing/list/BeanInjection::getMethod → NO_COVERAGE

62

1.1
Location : getVendor
Killed by : none
replaced return value with "" for com/jsql/view/swing/list/BeanInjection::getVendor → NO_COVERAGE

69

1.1
Location : getUrl
Killed by : none
replaced return value with "" for com/jsql/view/swing/list/BeanInjection::getUrl → NO_COVERAGE

73

1.1
Location : getRequest
Killed by : none
replaced return value with "" for com/jsql/view/swing/list/BeanInjection::getRequest → NO_COVERAGE

77

1.1
Location : getHeader
Killed by : none
replaced return value with "" for com/jsql/view/swing/list/BeanInjection::getHeader → NO_COVERAGE

81

1.1
Location : getRequestType
Killed by : none
replaced return value with "" for com/jsql/view/swing/list/BeanInjection::getRequestType → NO_COVERAGE

85

1.1
Location : getMethodInstance
Killed by : none
replaced return value with null for com/jsql/view/swing/list/BeanInjection::getMethodInstance → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.19.1