-
Notifications
You must be signed in to change notification settings - Fork 357
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
219 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
pitest-entry/src/main/java/org/pitest/mutationtest/verify/BuildIssue.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package org.pitest.mutationtest.verify; | ||
|
||
import java.util.Objects; | ||
|
||
public final class BuildIssue implements Comparable<BuildIssue> { | ||
private final String text; | ||
private final String url; | ||
private final int priority; | ||
|
||
public BuildIssue(String text, String url, int priority) { | ||
this.text = text; | ||
this.url = url; | ||
this.priority = priority; | ||
} | ||
|
||
public static BuildIssue issue(String text) { | ||
return new BuildIssue(text, null, 5); | ||
} | ||
|
||
public String text() { | ||
return text; | ||
} | ||
|
||
public String url() { | ||
return url; | ||
} | ||
|
||
public int priority() { | ||
return priority; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return text + " (" + url + ")"; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) { | ||
return true; | ||
} | ||
if (o == null || getClass() != o.getClass()) { | ||
return false; | ||
} | ||
BuildIssue that = (BuildIssue) o; | ||
return priority == that.priority && Objects.equals(text, that.text) && Objects.equals(url, that.url); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(text, url, priority); | ||
} | ||
|
||
@Override | ||
public int compareTo(BuildIssue o) { | ||
return Integer.compare(this.priority, o.priority); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
pitest-entry/src/test/java/org/pitest/mutationtest/verify/BuildIssueTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package org.pitest.mutationtest.verify; | ||
|
||
import nl.jqno.equalsverifier.EqualsVerifier; | ||
import org.junit.Test; | ||
|
||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
import static java.util.Arrays.asList; | ||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
|
||
public class BuildIssueTest { | ||
@Test | ||
public void obeysHashcodeEqualsContract() { | ||
EqualsVerifier.forClass(BuildIssue.class) | ||
.verify(); | ||
} | ||
|
||
@Test | ||
public void sortsZeroPriorityFirst() { | ||
BuildIssue a = new BuildIssue("a","",10); | ||
BuildIssue b = new BuildIssue("b","",0); | ||
BuildIssue c = new BuildIssue("c","",5); | ||
|
||
List<BuildIssue> l = asList(a,b,c); | ||
Collections.sort(l); | ||
assertThat(l).containsExactly(b,c,a); | ||
} | ||
} |
Oops, something went wrong.