fixing pitest failure by excluding purely generated code etc.
also removed unused methods and added a unit test to improve coverage and setting thresholds now to 90% each
This commit is contained in:
parent
1ac8df5ed9
commit
1bc7044527
25
build.gradle
25
build.gradle
@ -208,12 +208,29 @@ task cucumberTestReport(type: TestReport) {
|
|||||||
|
|
||||||
pitest {
|
pitest {
|
||||||
targetClasses = ['org.hostsharing.hsadminng.*']
|
targetClasses = ['org.hostsharing.hsadminng.*']
|
||||||
|
|
||||||
|
excludedClasses = [
|
||||||
|
// Unit Testing Spring configurations makes little sense in most cases.
|
||||||
|
'org.hostsharing.hsadminng.config.*',
|
||||||
|
'org.hostsharing.hsadminng.ApplicationWebXml',
|
||||||
|
'org.hostsharing.hsadminng.HsadminNgApp',
|
||||||
|
|
||||||
|
// Unit testing this would need PowerMock and
|
||||||
|
// blackbox testing of random values has little value.
|
||||||
|
'org.hostsharing.hsadminng.service.util.RandomUtil',
|
||||||
|
|
||||||
|
// The following are mostly generated classes,
|
||||||
|
// as soon as we amend these, consider removing the exclude.
|
||||||
|
'org.hostsharing.hsadminng.**Criteria',
|
||||||
|
'org.hostsharing.hsadminng.aop.logging.*',
|
||||||
|
'org.hostsharing.hsadminng.web.api.*' // API helpers, not the API itself
|
||||||
|
]
|
||||||
threads = 2
|
threads = 2
|
||||||
|
|
||||||
// Do not set these limit even lower, they are already pretty bad values!
|
// Do not set these limit lower! 90% each might sound good, but keep in mind:
|
||||||
// 83%*78% means that only ~66% of the code is properly covered by automated tests.
|
// 90%*90% means that ~81% of the code are properly covered by automated tests.
|
||||||
mutationThreshold = 78
|
mutationThreshold = 90
|
||||||
coverageThreshold = 83
|
coverageThreshold = 90
|
||||||
|
|
||||||
outputFormats = ['XML', 'HTML']
|
outputFormats = ['XML', 'HTML']
|
||||||
timestampedReports = false
|
timestampedReports = false
|
||||||
|
@ -195,16 +195,6 @@ public class Customer implements Serializable {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Customer removeMembership(Membership membership) {
|
|
||||||
this.memberships.remove(membership);
|
|
||||||
membership.setCustomer(null);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMemberships(Set<Membership> memberships) {
|
|
||||||
this.memberships = memberships;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Set<SepaMandate> getSepamandates() {
|
public Set<SepaMandate> getSepamandates() {
|
||||||
return sepamandates;
|
return sepamandates;
|
||||||
}
|
}
|
||||||
@ -220,15 +210,6 @@ public class Customer implements Serializable {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Customer removeSepamandate(SepaMandate sepaMandate) {
|
|
||||||
this.sepamandates.remove(sepaMandate);
|
|
||||||
sepaMandate.setCustomer(null);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSepamandates(Set<SepaMandate> sepaMandates) {
|
|
||||||
this.sepamandates = sepaMandates;
|
|
||||||
}
|
|
||||||
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove
|
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -129,16 +129,6 @@ public class Membership implements Serializable {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Membership removeShare(Share share) {
|
|
||||||
this.shares.remove(share);
|
|
||||||
share.setMembership(null);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setShares(Set<Share> shares) {
|
|
||||||
this.shares = shares;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Set<Asset> getAssets() {
|
public Set<Asset> getAssets() {
|
||||||
return assets;
|
return assets;
|
||||||
}
|
}
|
||||||
@ -154,16 +144,6 @@ public class Membership implements Serializable {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Membership removeAsset(Asset asset) {
|
|
||||||
this.assets.remove(asset);
|
|
||||||
asset.setMembership(null);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAssets(Set<Asset> assets) {
|
|
||||||
this.assets = assets;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Customer getCustomer() {
|
public Customer getCustomer() {
|
||||||
return customer;
|
return customer;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,15 @@
|
|||||||
|
package org.hostsharing.hsadminng.service.dto;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
|
public class MembershipDTOTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void withShouldApplyCallback() {
|
||||||
|
final MembershipDTO actual = new MembershipDTO().with(m -> m.setRemark("Some Remark"));
|
||||||
|
|
||||||
|
assertThat(actual.getRemark()).isEqualTo("Some Remark");
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user