Partition.java

1
package com.renomad.minum.web;
2
3
import com.renomad.minum.utils.StringUtils;
4
5
import java.util.Arrays;
6
import java.util.Objects;
7
8
/**
9
 * Represents a single partition in a multipart/form-data body response
10
 */
11
public final class Partition {
12
13
    private final Headers headers;
14
    private final byte[] content;
15
    private final ContentDisposition contentDisposition;
16
17
    public Partition(Headers headers, byte[] content, ContentDisposition contentDisposition) {
18
        this.headers = headers;
19
        this.content = content;
20
        this.contentDisposition = contentDisposition;
21
    }
22
23
    public Headers getHeaders() {
24 1 1. getHeaders : replaced return value with null for com/renomad/minum/web/Partition::getHeaders → KILLED
        return headers;
25
    }
26
27
    public ContentDisposition getContentDisposition() {
28 1 1. getContentDisposition : replaced return value with null for com/renomad/minum/web/Partition::getContentDisposition → KILLED
        return contentDisposition;
29
    }
30
31
    public byte[] getContent() {
32 1 1. getContent : replaced return value with null for com/renomad/minum/web/Partition::getContent → KILLED
        return content.clone();
33
    }
34
    public String getContentAsString() {
35 1 1. getContentAsString : replaced return value with "" for com/renomad/minum/web/Partition::getContentAsString → KILLED
        return StringUtils.byteArrayToString(content);
36
    }
37
38
    @Override
39
    public boolean equals(Object o) {
40 2 1. equals : negated conditional → KILLED
2. equals : replaced boolean return with false for com/renomad/minum/web/Partition::equals → KILLED
        if (this == o) return true;
41 3 1. equals : negated conditional → TIMED_OUT
2. equals : negated conditional → KILLED
3. equals : replaced boolean return with true for com/renomad/minum/web/Partition::equals → KILLED
        if (o == null || getClass() != o.getClass()) return false;
42
        Partition partition = (Partition) o;
43 4 1. equals : negated conditional → KILLED
2. equals : negated conditional → KILLED
3. equals : replaced boolean return with true for com/renomad/minum/web/Partition::equals → KILLED
4. equals : negated conditional → KILLED
        return Objects.equals(headers, partition.headers) && Arrays.equals(content, partition.content) && Objects.equals(contentDisposition, partition.contentDisposition);
44
    }
45
46
    @Override
47
    public int hashCode() {
48
        int result = Objects.hash(headers, contentDisposition);
49 2 1. hashCode : Replaced integer addition with subtraction → SURVIVED
2. hashCode : Replaced integer multiplication with division → KILLED
        result = 31 * result + Arrays.hashCode(content);
50 1 1. hashCode : replaced int return with 0 for com/renomad/minum/web/Partition::hashCode → KILLED
        return result;
51
    }
52
53
    @Override
54
    public String toString() {
55 1 1. toString : replaced return value with "" for com/renomad/minum/web/Partition::toString → KILLED
        return "Partition{" +
56
                "headers=" + headers +
57
                ", contentDisposition=" + contentDisposition +
58
                '}';
59
    }
60
}

Mutations

24

1.1
Location : getHeaders
Killed by : com.renomad.minum.web.WebTests
replaced return value with null for com/renomad/minum/web/Partition::getHeaders → KILLED

28

1.1
Location : getContentDisposition
Killed by : com.renomad.minum.web.BodyProcessorTests
replaced return value with null for com/renomad/minum/web/Partition::getContentDisposition → KILLED

32

1.1
Location : getContent
Killed by : com.renomad.minum.web.BodyProcessorTests
replaced return value with null for com/renomad/minum/web/Partition::getContent → KILLED

35

1.1
Location : getContentAsString
Killed by : com.renomad.minum.web.WebTests
replaced return value with "" for com/renomad/minum/web/Partition::getContentAsString → KILLED

40

1.1
Location : equals
Killed by : com.renomad.minum.EqualsTests.equalsTest(com.renomad.minum.EqualsTests)
negated conditional → KILLED

2.2
Location : equals
Killed by : com.renomad.minum.EqualsTests.equalsTest(com.renomad.minum.EqualsTests)
replaced boolean return with false for com/renomad/minum/web/Partition::equals → KILLED

41

1.1
Location : equals
Killed by : none
negated conditional → TIMED_OUT

2.2
Location : equals
Killed by : com.renomad.minum.EqualsTests.equalsTest(com.renomad.minum.EqualsTests)
negated conditional → KILLED

3.3
Location : equals
Killed by : com.renomad.minum.EqualsTests.equalsTest(com.renomad.minum.EqualsTests)
replaced boolean return with true for com/renomad/minum/web/Partition::equals → KILLED

43

1.1
Location : equals
Killed by : com.renomad.minum.EqualsTests.equalsTest(com.renomad.minum.EqualsTests)
negated conditional → KILLED

2.2
Location : equals
Killed by : com.renomad.minum.EqualsTests.equalsTest(com.renomad.minum.EqualsTests)
negated conditional → KILLED

3.3
Location : equals
Killed by : com.renomad.minum.EqualsTests.equalsTest(com.renomad.minum.EqualsTests)
replaced boolean return with true for com/renomad/minum/web/Partition::equals → KILLED

4.4
Location : equals
Killed by : com.renomad.minum.EqualsTests.equalsTest(com.renomad.minum.EqualsTests)
negated conditional → KILLED

49

1.1
Location : hashCode
Killed by : none
Replaced integer addition with subtraction → SURVIVED
Covering tests

2.2
Location : hashCode
Killed by : com.renomad.minum.EqualsTests.equalsTest(com.renomad.minum.EqualsTests)
Replaced integer multiplication with division → KILLED

50

1.1
Location : hashCode
Killed by : com.renomad.minum.EqualsTests.equalsTest(com.renomad.minum.EqualsTests)
replaced int return with 0 for com/renomad/minum/web/Partition::hashCode → KILLED

55

1.1
Location : toString
Killed by : com.renomad.minum.web.WebTests
replaced return value with "" for com/renomad/minum/web/Partition::toString → KILLED

Active mutators

Tests examined


Report generated by PIT 1.17.0