View Javadoc
1   /*
2    * SPDX-FileCopyrightText: Copyright (c) 2012-2026 Yegor Bugayenko
3    * SPDX-License-Identifier: MIT
4    */
5   package com.jcabi.dynamo;
6   
7   import org.hamcrest.MatcherAssert;
8   import org.hamcrest.Matchers;
9   import org.junit.jupiter.api.Assertions;
10  import org.junit.jupiter.api.Test;
11  
12  /**
13   * Test case for {@link Dosage.Empty}.
14   * @since 0.1
15   */
16  final class DosageTest {
17  
18      @Test
19      void returnsEmptyItemsList() {
20          MatcherAssert.assertThat(
21              "does not return empty items list",
22              new Dosage.Empty().items(),
23              Matchers.empty()
24          );
25      }
26  
27      @Test
28      void returnsFalseForHasNext() {
29          MatcherAssert.assertThat(
30              "does not return false for hasNext on empty dosage",
31              new Dosage.Empty().hasNext(),
32              Matchers.is(false)
33          );
34      }
35  
36      @Test
37      void throwsOnNextWhenEmpty() {
38          Assertions.assertThrows(
39              IllegalStateException.class,
40              () -> new Dosage.Empty().next()
41          );
42      }
43  }