mirror of
https://github.com/cincheo/jsweet.git
synced 2025-12-15 07:19:22 +00:00
added test for Enum.values()
This commit is contained in:
parent
3f5fd896ae
commit
6341b398d6
@ -1,9 +1,21 @@
|
||||
package source.enums;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class ComplexEnumsWithInterface {
|
||||
private final static Map<Integer, DayOfWeek> ORDINAL_MAP = new HashMap<>();
|
||||
|
||||
public static DayOfWeek fromPersistenceValue(Integer value) {
|
||||
return ORDINAL_MAP.get(value);
|
||||
}
|
||||
public static void main(String[] args) {
|
||||
DayOfWeek day = DayOfWeek.Wednesday;
|
||||
assert day.persistenceValue == 3;
|
||||
for (DayOfWeek c : DayOfWeek.values()) {
|
||||
ORDINAL_MAP.put(c.persistenceValue, c);
|
||||
}
|
||||
assert ORDINAL_MAP.get(1) == DayOfWeek.Monday;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user