-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathSKU.java
37 lines (31 loc) · 902 Bytes
/
SKU.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package io.split.client.testing.cucumber;
import java.util.Objects;
/**
* A simple <a href="https://en.wikipedia.org/wiki/Stock_keeping_unit">Stock Keeping Unit</a> (SKU).
*/
public class SKU {
private final String name;
private final double price;
public SKU(String name, double price) {
this.name = name;
this.price = price;
}
@Override
public String toString() {
return "SKU{" +
"name='" + name + '\'' +
", price=" + price +
'}';
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
SKU sku = (SKU) o;
return Double.compare(sku.price, price) == 0 && name.equals(sku.name);
}
@Override
public int hashCode() {
return Objects.hash(name, price);
}
}