|
1 | 1 | package seatsio.events;
|
2 | 2 |
|
3 | 3 | import com.google.common.collect.ImmutableMap;
|
| 4 | +import com.google.common.collect.Lists; |
4 | 5 | import org.junit.jupiter.api.Test;
|
5 | 6 | import seatsio.SeatsioClientTest;
|
6 | 7 | import seatsio.util.Lister;
|
|
10 | 11 | import java.util.List;
|
11 | 12 | import java.util.stream.Stream;
|
12 | 13 |
|
| 14 | +import static com.google.common.collect.Lists.newArrayList; |
13 | 15 | import static java.time.temporal.ChronoUnit.MINUTES;
|
14 | 16 | import static java.util.Arrays.asList;
|
15 | 17 | import static java.util.stream.Collectors.toList;
|
16 | 18 | import static org.assertj.core.api.Assertions.assertThat;
|
17 | 19 | import static seatsio.SortDirection.DESC;
|
| 20 | +import static seatsio.events.ObjectNotPresentReason.SWITCHED_TO_BOOK_BY_SEAT; |
18 | 21 | import static seatsio.events.StatusChangeOriginType.API_CALL;
|
| 22 | +import static seatsio.events.TableBookingConfig.allBySeat; |
| 23 | +import static seatsio.events.TableBookingConfig.allByTable; |
19 | 24 |
|
20 | 25 | public class ListStatusChangesTest extends SeatsioClientTest {
|
21 | 26 |
|
@@ -54,6 +59,22 @@ public void propertiesOfStatusChange() {
|
54 | 59 | assertThat(statusChange.extraData).isEqualTo(ImmutableMap.of("foo", "bar"));
|
55 | 60 | assertThat(statusChange.origin.type).isEqualTo(API_CALL);
|
56 | 61 | assertThat(statusChange.origin.ip).isNotNull();
|
| 62 | + assertThat(statusChange.isPresentOnChart).isTrue(); |
| 63 | + assertThat(statusChange.notPresentOnChartReason).isNull(); |
| 64 | + } |
| 65 | + |
| 66 | + @Test |
| 67 | + public void objectNotPresentAnymore() { |
| 68 | + String chartKey = createTestChartWithTables(); |
| 69 | + Event event = client.events.create(chartKey, "event1", allByTable()); |
| 70 | + client.events.book(event.key, newArrayList("T1")); |
| 71 | + client.events.update("event1", null, null, allBySeat()); |
| 72 | + |
| 73 | + Stream<StatusChange> statusChanges = client.events.statusChanges(event.key).all(); |
| 74 | + StatusChange statusChange = statusChanges.findFirst().get(); |
| 75 | + |
| 76 | + assertThat(statusChange.isPresentOnChart).isFalse(); |
| 77 | + assertThat(statusChange.notPresentOnChartReason).isEqualTo(SWITCHED_TO_BOOK_BY_SEAT); |
57 | 78 | }
|
58 | 79 |
|
59 | 80 | @Test
|
|
0 commit comments