WarehouseService.java

1
package com.rbctcsworld.ecommerce.inventory;
2
3
import com.rbctcsworld.ecommerce.audit.AuditChange;
4
import com.rbctcsworld.ecommerce.audit.AuditEvent;
5
import com.rbctcsworld.ecommerce.common.exception.BusinessRuleException;
6
import com.rbctcsworld.ecommerce.common.exception.ConflictException;
7
import com.rbctcsworld.ecommerce.common.exception.NotFoundException;
8
import com.rbctcsworld.ecommerce.inventory.WarehouseDtos.Adjust;
9
import com.rbctcsworld.ecommerce.inventory.WarehouseDtos.CreateWarehouse;
10
import com.rbctcsworld.ecommerce.inventory.WarehouseDtos.ProductStock;
11
import com.rbctcsworld.ecommerce.inventory.WarehouseDtos.StockLine;
12
import com.rbctcsworld.ecommerce.inventory.WarehouseDtos.Transfer;
13
import com.rbctcsworld.ecommerce.inventory.WarehouseDtos.UpdateWarehouse;
14
import com.rbctcsworld.ecommerce.inventory.WarehouseDtos.WarehouseView;
15
import com.rbctcsworld.ecommerce.product.Product;
16
import com.rbctcsworld.ecommerce.product.ProductRepository;
17
import org.springframework.context.ApplicationEventPublisher;
18
import org.springframework.stereotype.Service;
19
import org.springframework.transaction.annotation.Transactional;
20
21
import java.util.List;
22
import java.util.Locale;
23
24
/**
25
 * Store admin: warehouses, and stock per warehouse (receive goods, correct a count, write off damage,
26
 * move stock between warehouses). Every change keeps products.stock = SUM(warehouse_stock) and writes
27
 * stock movements; warehouse changes go to the audit trail.
28
 *
29
 * Lock order is the same as for orders: the product row first, then its warehouse rows.
30
 */
31
@Service
32
@Transactional
33
public class WarehouseService {
34
35
    private final WarehouseStore store;
36
    private final ProductRepository products;
37
    private final StockMovementRepository movements;
38
    private final ApplicationEventPublisher events;
39
40
    public WarehouseService(WarehouseStore store, ProductRepository products, StockMovementRepository movements,
41
                            ApplicationEventPublisher events) {
42
        this.store = store;
43
        this.products = products;
44
        this.movements = movements;
45
        this.events = events;
46
    }
47
48
    // ---------------------------------------------------------------- warehouses
49
50
    @Transactional(readOnly = true)
51
    public List<WarehouseView> all() {
52 1 1. all : replaced return value with Collections.emptyList for com/rbctcsworld/ecommerce/inventory/WarehouseService::all → KILLED
        return store.all().stream().map(this::view).toList();
53
    }
54
55
    public WarehouseView create(CreateWarehouse r) {
56
        String code = r.code().trim().toUpperCase(Locale.ROOT);
57 1 1. create : removed conditional - replaced equality check with false → KILLED
        if (store.codeExists(code)) throw new ConflictException("Warehouse code already exists: " + code);
58
        long id = store.insert(code, r.name().trim(), r.city().trim(), r.state().trim().toUpperCase(Locale.ROOT), r.priority());
59
        Warehouse w = store.find(id).orElseThrow();
60 1 1. create : removed call to org/springframework/context/ApplicationEventPublisher::publishEvent → KILLED
        events.publishEvent(AuditEvent.of(AuditChange.diff(AuditChange.WAREHOUSE, id, "WAREHOUSE_CREATED", null, audited(w))));
61 1 1. create : replaced return value with null for com/rbctcsworld/ecommerce/inventory/WarehouseService::create → KILLED
        return view(w);
62
    }
63
64
    /**
65
     * Edits a warehouse. Switching one off is only allowed when it is empty (move its stock first) and
66
     * another warehouse stays active (new stock needs a home).
67
     */
68
    public WarehouseView update(long id, UpdateWarehouse r) {
69 1 1. lambda$update$0 : replaced return value with null for com/rbctcsworld/ecommerce/inventory/WarehouseService::lambda$update$0 → KILLED
        Warehouse w = store.find(id).orElseThrow(() -> new NotFoundException("Warehouse not found: " + id));
70 2 1. update : removed conditional - replaced equality check with false → KILLED
2. update : removed conditional - replaced equality check with false → KILLED
        if (w.active() && !r.active()) {
71 2 1. update : changed conditional boundary → KILLED
2. update : removed conditional - replaced comparison check with false → KILLED
            if (store.unitsIn(id) > 0) {
72
                throw new ConflictException("Warehouse " + w.code() + " still holds stock: move it to another warehouse first");
73
            }
74 2 1. update : removed conditional - replaced comparison check with false → KILLED
2. update : changed conditional boundary → KILLED
            if (store.activeCount() <= 1) throw new ConflictException("At least one warehouse must stay active");
75
        }
76 1 1. update : removed call to com/rbctcsworld/ecommerce/inventory/WarehouseStore::update → KILLED
        store.update(id, r.name().trim(), r.city().trim(), r.state().trim().toUpperCase(Locale.ROOT), r.priority(), r.active());
77
        Warehouse after = store.find(id).orElseThrow();
78 1 1. update : removed call to org/springframework/context/ApplicationEventPublisher::publishEvent → KILLED
        events.publishEvent(AuditEvent.of(AuditChange.diff(AuditChange.WAREHOUSE, id, "WAREHOUSE_UPDATED", audited(w),
79
                audited(after))));
80 1 1. update : replaced return value with null for com/rbctcsworld/ecommerce/inventory/WarehouseService::update → KILLED
        return view(after);
81
    }
82
83
    // ---------------------------------------------------------------- stock per warehouse
84
85
    /** The product's stock in every warehouse (also the empty ones), total first. */
86
    @Transactional(readOnly = true)
87
    public ProductStock stockOf(long productId) {
88 1 1. lambda$stockOf$1 : replaced return value with null for com/rbctcsworld/ecommerce/inventory/WarehouseService::lambda$stockOf$1 → KILLED
        Product p = products.findById(productId).orElseThrow(() -> new NotFoundException("Product not found: " + productId));
89 1 1. lambda$stockOf$2 : replaced return value with null for com/rbctcsworld/ecommerce/inventory/WarehouseService::lambda$stockOf$2 → KILLED
        List<StockLine> lines = store.all().stream().map(w -> new StockLine(w.id(), w.code(), w.city(), w.state(),
90
                w.active(), store.quantity(w.id(), productId))).toList();
91 1 1. stockOf : replaced return value with null for com/rbctcsworld/ecommerce/inventory/WarehouseService::stockOf → KILLED
        return new ProductStock(productId, p.getSku(), p.getName(), products.currentStock(productId), lines);
92
    }
93
94
    /** Received goods (+), a count correction (+/-) or damaged units written off (-), in one warehouse. */
95
    public ProductStock adjust(Adjust a) {
96 1 1. adjust : removed conditional - replaced equality check with false → KILLED
        if (a.delta() == 0) throw new BusinessRuleException("delta must not be 0");
97 3 1. adjust : changed conditional boundary → SURVIVED
2. adjust : removed conditional - replaced comparison check with false → KILLED
3. adjust : removed conditional - replaced equality check with false → KILLED
        if (a.reason().equals(StockMovement.RECEIVED) && a.delta() < 0) throw new BusinessRuleException("RECEIVED adds units");
98 3 1. adjust : changed conditional boundary → SURVIVED
2. adjust : removed conditional - replaced comparison check with false → KILLED
3. adjust : removed conditional - replaced equality check with false → KILLED
        if (a.reason().equals(StockMovement.DAMAGED) && a.delta() > 0) throw new BusinessRuleException("DAMAGED removes units");
99 2 1. adjust : changed conditional boundary → SURVIVED
2. adjust : removed conditional - replaced comparison check with false → KILLED
        Warehouse w = activeWarehouse(a.warehouseId(), a.delta() > 0);
100 1 1. adjust : removed call to com/rbctcsworld/ecommerce/inventory/WarehouseService::lockProduct → KILLED
        lockProduct(a.productId());
101
        store.lockStock(a.productId());
102 2 1. adjust : changed conditional boundary → SURVIVED
2. adjust : removed conditional - replaced comparison check with false → KILLED
        if (a.delta() > 0) {
103 1 1. adjust : removed call to com/rbctcsworld/ecommerce/inventory/WarehouseStore::put → KILLED
            store.put(w.id(), a.productId(), a.delta());
104 2 1. adjust : removed negation → KILLED
2. adjust : removed conditional - replaced equality check with false → KILLED
        } else if (!store.take(w.id(), a.productId(), -a.delta())) {
105
            throw new ConflictException(w.code() + " holds only " + store.quantity(w.id(), a.productId()) + " of this product");
106
        }
107
        products.incrementStock(a.productId(), a.delta());
108
        movements.save(new StockMovement(a.productId(), null, w.id(), a.delta(), a.reason(),
109
                products.currentStock(a.productId())));
110 1 1. adjust : replaced return value with null for com/rbctcsworld/ecommerce/inventory/WarehouseService::adjust → KILLED
        return stockOf(a.productId());
111
    }
112
113
    /** Moves units from one warehouse to another; the total does not change. */
114
    public ProductStock transfer(Transfer t) {
115 1 1. transfer : removed conditional - replaced equality check with false → KILLED
        if (t.fromWarehouseId().equals(t.toWarehouseId())) throw new BusinessRuleException("from and to must be different warehouses");
116
        Warehouse from = store.find(t.fromWarehouseId())
117 1 1. lambda$transfer$3 : replaced return value with null for com/rbctcsworld/ecommerce/inventory/WarehouseService::lambda$transfer$3 → KILLED
                .orElseThrow(() -> new NotFoundException("Warehouse not found: " + t.fromWarehouseId()));
118
        Warehouse to = activeWarehouse(t.toWarehouseId(), true);
119 1 1. transfer : removed call to com/rbctcsworld/ecommerce/inventory/WarehouseService::lockProduct → SURVIVED
        lockProduct(t.productId());
120
        store.lockStock(t.productId());
121 1 1. transfer : removed conditional - replaced equality check with false → KILLED
        if (!store.take(from.id(), t.productId(), t.quantity())) {
122
            throw new ConflictException(from.code() + " holds only " + store.quantity(from.id(), t.productId()) + " of this product");
123
        }
124 1 1. transfer : removed call to com/rbctcsworld/ecommerce/inventory/WarehouseStore::put → KILLED
        store.put(to.id(), t.productId(), t.quantity());
125
        int total = products.currentStock(t.productId());
126 2 1. transfer : removed negation → KILLED
2. transfer : Replaced integer subtraction with addition → KILLED
        movements.save(new StockMovement(t.productId(), null, from.id(), -t.quantity(), StockMovement.TRANSFER_OUT, total - t.quantity()));
127
        movements.save(new StockMovement(t.productId(), null, to.id(), t.quantity(), StockMovement.TRANSFER_IN, total));
128 1 1. transfer : replaced return value with null for com/rbctcsworld/ecommerce/inventory/WarehouseService::transfer → KILLED
        return stockOf(t.productId());
129
    }
130
131
    @Transactional(readOnly = true)
132
    public List<WarehouseStore.OrderAllocation> allocations(long orderId) {
133 1 1. allocations : replaced return value with Collections.emptyList for com/rbctcsworld/ecommerce/inventory/WarehouseService::allocations → KILLED
        return store.allocations(orderId);
134
    }
135
136
    // ---------------------------------------------------------------- helpers
137
138
    /** Units may only go INTO an active warehouse; taking out of a switched-off one (emptying it) is fine. */
139
    private Warehouse activeWarehouse(long id, boolean receiving) {
140 1 1. lambda$activeWarehouse$4 : replaced return value with null for com/rbctcsworld/ecommerce/inventory/WarehouseService::lambda$activeWarehouse$4 → KILLED
        Warehouse w = store.find(id).orElseThrow(() -> new NotFoundException("Warehouse not found: " + id));
141 2 1. activeWarehouse : removed conditional - replaced equality check with false → KILLED
2. activeWarehouse : removed conditional - replaced equality check with false → KILLED
        if (receiving && !w.active()) throw new ConflictException("Warehouse " + w.code() + " is switched off");
142 1 1. activeWarehouse : replaced return value with null for com/rbctcsworld/ecommerce/inventory/WarehouseService::activeWarehouse → KILLED
        return w;
143
    }
144
145
    private void lockProduct(long productId) {
146 1 1. lambda$lockProduct$5 : replaced return value with null for com/rbctcsworld/ecommerce/inventory/WarehouseService::lambda$lockProduct$5 → KILLED
        products.lockById(productId).orElseThrow(() -> new NotFoundException("Product not found: " + productId));
147
    }
148
149
    private WarehouseView view(Warehouse w) {
150 1 1. view : replaced return value with null for com/rbctcsworld/ecommerce/inventory/WarehouseService::view → KILLED
        return new WarehouseView(w.id(), w.code(), w.name(), w.city(), w.state(), w.priority(), w.active(), store.unitsIn(w.id()));
151
    }
152
153
    static java.util.Map<String, Object> audited(Warehouse w) {
154 1 1. audited : replaced return value with Collections.emptyMap for com/rbctcsworld/ecommerce/inventory/WarehouseService::audited → KILLED
        return AuditChange.fields("code", w.code(), "name", w.name(), "city", w.city(), "state", w.state(),
155
                "priority", w.priority(), "active", w.active());
156
    }
157
}

Mutations

52

1.1
Location : all
Killed by : com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest]/[method:theListShowsWhatEachWarehouseHolds()]
replaced return value with Collections.emptyList for com/rbctcsworld/ecommerce/inventory/WarehouseService::all → KILLED

57

1.1
Location : create
Killed by : com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest]/[method:aWarehouseCodeIsUnique()]
removed conditional - replaced equality check with false → KILLED

60

1.1
Location : create
Killed by : com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest]/[method:aNewWarehouseGetsANormalisedCodeAndStateAndIsAudited()]
removed call to org/springframework/context/ApplicationEventPublisher::publishEvent → KILLED

61

1.1
Location : create
Killed by : com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest]/[method:aNewWarehouseGetsANormalisedCodeAndStateAndIsAudited()]
replaced return value with null for com/rbctcsworld/ecommerce/inventory/WarehouseService::create → KILLED

69

1.1
Location : lambda$update$0
Killed by : com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest]/[method:anUnknownWarehouseIs404()]
replaced return value with null for com/rbctcsworld/ecommerce/inventory/WarehouseService::lambda$update$0 → KILLED

70

1.1
Location : update
Killed by : com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest]/[method:aWarehouseIsSwitchedOffOnlyWhenEmptyAndNotTheLastOne()]
removed conditional - replaced equality check with false → KILLED

2.2
Location : update
Killed by : com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest]/[method:aWarehouseIsSwitchedOffOnlyWhenEmptyAndNotTheLastOne()]
removed conditional - replaced equality check with false → KILLED

71

1.1
Location : update
Killed by : com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest]/[method:aWarehouseIsSwitchedOffOnlyWhenEmptyAndNotTheLastOne()]
changed conditional boundary → KILLED

2.2
Location : update
Killed by : com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest]/[method:aWarehouseIsSwitchedOffOnlyWhenEmptyAndNotTheLastOne()]
removed conditional - replaced comparison check with false → KILLED

74

1.1
Location : update
Killed by : com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest]/[method:aWarehouseIsSwitchedOffOnlyWhenEmptyAndNotTheLastOne()]
removed conditional - replaced comparison check with false → KILLED

2.2
Location : update
Killed by : com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest]/[method:aWarehouseIsSwitchedOffOnlyWhenEmptyAndNotTheLastOne()]
changed conditional boundary → KILLED

76

1.1
Location : update
Killed by : com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest]/[method:anEditIsAuditedWithOnlyWhatChanged()]
removed call to com/rbctcsworld/ecommerce/inventory/WarehouseStore::update → KILLED

78

1.1
Location : update
Killed by : com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest]/[method:anEditIsAuditedWithOnlyWhatChanged()]
removed call to org/springframework/context/ApplicationEventPublisher::publishEvent → KILLED

80

1.1
Location : update
Killed by : com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest]/[method:anEditIsAuditedWithOnlyWhatChanged()]
replaced return value with null for com/rbctcsworld/ecommerce/inventory/WarehouseService::update → KILLED

88

1.1
Location : lambda$stockOf$1
Killed by : com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest]/[method:theStockOfAProductListsEveryWarehouseAlsoTheEmptyOnes()]
replaced return value with null for com/rbctcsworld/ecommerce/inventory/WarehouseService::lambda$stockOf$1 → KILLED

89

1.1
Location : lambda$stockOf$2
Killed by : com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest]/[method:theStockOfAProductListsEveryWarehouseAlsoTheEmptyOnes()]
replaced return value with null for com/rbctcsworld/ecommerce/inventory/WarehouseService::lambda$stockOf$2 → KILLED

91

1.1
Location : stockOf
Killed by : com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest]/[method:theStockOfAProductListsEveryWarehouseAlsoTheEmptyOnes()]
replaced return value with null for com/rbctcsworld/ecommerce/inventory/WarehouseService::stockOf → KILLED

96

1.1
Location : adjust
Killed by : com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest]/[method:theReasonMustFitTheDirection()]
removed conditional - replaced equality check with false → KILLED

97

1.1
Location : adjust
Killed by : com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest]/[method:theReasonMustFitTheDirection()]
removed conditional - replaced comparison check with false → KILLED

2.2
Location : adjust
Killed by : none
changed conditional boundary → SURVIVED
Covering tests

3.3
Location : adjust
Killed by : com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest]/[method:theReasonMustFitTheDirection()]
removed conditional - replaced equality check with false → KILLED

98

1.1
Location : adjust
Killed by : none
changed conditional boundary → SURVIVED
Covering tests

2.2
Location : adjust
Killed by : com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest]/[method:theReasonMustFitTheDirection()]
removed conditional - replaced comparison check with false → KILLED

3.3
Location : adjust
Killed by : com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest]/[method:theReasonMustFitTheDirection()]
removed conditional - replaced equality check with false → KILLED

99

1.1
Location : adjust
Killed by : com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest]/[method:aSwitchedOffWarehouseReceivesNothingButCanBeEmptied()]
removed conditional - replaced comparison check with false → KILLED

2.2
Location : adjust
Killed by : none
changed conditional boundary → SURVIVED
Covering tests

100

1.1
Location : adjust
Killed by : com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest]/[method:aMissingProductIs404BeforeAnythingChanges()]
removed call to com/rbctcsworld/ecommerce/inventory/WarehouseService::lockProduct → KILLED

102

1.1
Location : adjust
Killed by : com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest]/[method:receivedGoodsGoIntoTheWarehouseAndTheTotalProductFirst()]
removed conditional - replaced comparison check with false → KILLED

2.2
Location : adjust
Killed by : none
changed conditional boundary → SURVIVED
Covering tests

103

1.1
Location : adjust
Killed by : com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest]/[method:receivedGoodsGoIntoTheWarehouseAndTheTotalProductFirst()]
removed call to com/rbctcsworld/ecommerce/inventory/WarehouseStore::put → KILLED

104

1.1
Location : adjust
Killed by : com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest]/[method:aSwitchedOffWarehouseReceivesNothingButCanBeEmptied()]
removed negation → KILLED

2.2
Location : adjust
Killed by : com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest]/[method:damagedUnitsAreTakenOnlyIfTheWarehouseHasThem()]
removed conditional - replaced equality check with false → KILLED

110

1.1
Location : adjust
Killed by : com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest]/[method:receivedGoodsGoIntoTheWarehouseAndTheTotalProductFirst()]
replaced return value with null for com/rbctcsworld/ecommerce/inventory/WarehouseService::adjust → KILLED

115

1.1
Location : transfer
Killed by : com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest]/[method:aTransferNeedsTwoWarehousesEnoughUnitsAndAnActiveDestination()]
removed conditional - replaced equality check with false → KILLED

117

1.1
Location : lambda$transfer$3
Killed by : com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest]/[method:anUnknownWarehouseIs404()]
replaced return value with null for com/rbctcsworld/ecommerce/inventory/WarehouseService::lambda$transfer$3 → KILLED

119

1.1
Location : transfer
Killed by : none
removed call to com/rbctcsworld/ecommerce/inventory/WarehouseService::lockProduct → SURVIVED
Covering tests

121

1.1
Location : transfer
Killed by : com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest]/[method:aTransferNeedsTwoWarehousesEnoughUnitsAndAnActiveDestination()]
removed conditional - replaced equality check with false → KILLED

124

1.1
Location : transfer
Killed by : com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest]/[method:aTransferMovesUnitsWithoutChangingTheTotal()]
removed call to com/rbctcsworld/ecommerce/inventory/WarehouseStore::put → KILLED

126

1.1
Location : transfer
Killed by : com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest]/[method:aTransferMovesUnitsWithoutChangingTheTotal()]
removed negation → KILLED

2.2
Location : transfer
Killed by : com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest]/[method:aTransferMovesUnitsWithoutChangingTheTotal()]
Replaced integer subtraction with addition → KILLED

128

1.1
Location : transfer
Killed by : com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest]/[method:aTransferMovesUnitsWithoutChangingTheTotal()]
replaced return value with null for com/rbctcsworld/ecommerce/inventory/WarehouseService::transfer → KILLED

133

1.1
Location : allocations
Killed by : com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest]/[method:allocationsComeFromTheStore()]
replaced return value with Collections.emptyList for com/rbctcsworld/ecommerce/inventory/WarehouseService::allocations → KILLED

140

1.1
Location : lambda$activeWarehouse$4
Killed by : com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest]/[method:anUnknownWarehouseIs404()]
replaced return value with null for com/rbctcsworld/ecommerce/inventory/WarehouseService::lambda$activeWarehouse$4 → KILLED

141

1.1
Location : activeWarehouse
Killed by : com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest]/[method:aTransferNeedsTwoWarehousesEnoughUnitsAndAnActiveDestination()]
removed conditional - replaced equality check with false → KILLED

2.2
Location : activeWarehouse
Killed by : com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest]/[method:aTransferNeedsTwoWarehousesEnoughUnitsAndAnActiveDestination()]
removed conditional - replaced equality check with false → KILLED

142

1.1
Location : activeWarehouse
Killed by : com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest]/[method:aSwitchedOffWarehouseReceivesNothingButCanBeEmptied()]
replaced return value with null for com/rbctcsworld/ecommerce/inventory/WarehouseService::activeWarehouse → KILLED

146

1.1
Location : lambda$lockProduct$5
Killed by : com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest]/[method:aMissingProductIs404BeforeAnythingChanges()]
replaced return value with null for com/rbctcsworld/ecommerce/inventory/WarehouseService::lambda$lockProduct$5 → KILLED

150

1.1
Location : view
Killed by : com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest]/[method:theListShowsWhatEachWarehouseHolds()]
replaced return value with null for com/rbctcsworld/ecommerce/inventory/WarehouseService::view → KILLED

154

1.1
Location : audited
Killed by : com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest.[engine:junit-jupiter]/[class:com.rbctcsworld.ecommerce.inventory.WarehouseServiceTest]/[method:anEditIsAuditedWithOnlyWhatChanged()]
replaced return value with Collections.emptyMap for com/rbctcsworld/ecommerce/inventory/WarehouseService::audited → KILLED

Active mutators

Tests examined


Report generated by PIT 1.30.0 support