Lock.java

1
package org.sanmibuh.tedee.lock.domain;
2
3
import org.sanmibuh.ddd.domain.AggregateRoot;
4
import org.sanmibuh.tedee.lock.domain.event.LockRequested;
5
import org.sanmibuh.tedee.lock.domain.event.LockStatusReported;
6
import org.sanmibuh.tedee.lock.domain.vo.LockId;
7
import org.sanmibuh.tedee.lock.domain.vo.LockJamStatus;
8
import org.sanmibuh.tedee.lock.domain.vo.LockState;
9
import org.sanmibuh.tedee.lock.domain.vo.LockStatus;
10
11
public final class Lock extends AggregateRoot<LockId> {
12
13
  private LockStatus status;
14
15
  public Lock(final LockId id, final LockStatus status) {
16
    super(id);
17
    this.status = status;
18
  }
19
20
  public void lock() {
21 1 1. lock : negated conditional → KILLED
    if (status == LockStatus.LOCKED) {
22
      return;
23
    }
24
    status = LockStatus.LOCKED;
25 1 1. lock : removed call to org/sanmibuh/tedee/lock/domain/Lock::recordEvent → KILLED
    recordEvent(new LockRequested(id().value()));
26
  }
27
28
  public void reportStatus(final LockState state, final LockJamStatus jamStatus) {
29 1 1. reportStatus : removed call to org/sanmibuh/tedee/lock/domain/Lock::recordEvent → KILLED
    recordEvent(new LockStatusReported(id().value(), state, jamStatus));
30
  }
31
}

Mutations

21

1.1
Location : lock
Killed by : org.sanmibuh.tedee.lock.application.CloseLockHandlerTest.[engine:junit-jupiter]/[class:org.sanmibuh.tedee.lock.application.CloseLockHandlerTest]/[method:should_recordLockRequestedAndReturnEvents_whenClosingAnOpenLock()]
negated conditional → KILLED

25

1.1
Location : lock
Killed by : org.sanmibuh.tedee.lock.application.CloseLockHandlerTest.[engine:junit-jupiter]/[class:org.sanmibuh.tedee.lock.application.CloseLockHandlerTest]/[method:should_recordLockRequestedAndReturnEvents_whenClosingAnOpenLock()]
removed call to org/sanmibuh/tedee/lock/domain/Lock::recordEvent → KILLED

29

1.1
Location : reportStatus
Killed by : org.sanmibuh.tedee.lock.application.ReportLockStatusHandlerTest.[engine:junit-jupiter]/[class:org.sanmibuh.tedee.lock.application.ReportLockStatusHandlerTest]/[test-template:should_recordLockStatusReported_whenReportingJammedState(int)]/[test-template-invocation:#2]
removed call to org/sanmibuh/tedee/lock/domain/Lock::recordEvent → KILLED

Active mutators

Tests examined


Report generated by PIT 1.30.0 support