View Javadoc
1   /*
2    * Copyright (C) 2022-2023 Dipl.-Inform. Kai Hofmann. All rights reserved!
3    */
4   package de.powerstat.validation.values.test;
5   
6   
7   import static org.junit.jupiter.api.Assertions.assertAll;
8   import static org.junit.jupiter.api.Assertions.assertEquals;
9   
10  import org.junit.jupiter.api.Test;
11  
12  import de.powerstat.validation.values.Weekday;
13  
14  
15  /**
16   * Weekday tests.
17   */
18  final class WeekdayTests
19   {
20    /**
21     * Monday action not as expected constant.
22     */
23    private static final String MONDAY_ACTION_NOT_AS_EXPECTED = "1 action not as expected";
24  
25  
26    /**
27     * Default constructor.
28     */
29    /* default */ WeekdayTests()
30     {
31      super();
32     }
33  
34  
35    /**
36     * Factory string test.
37     */
38    @Test
39    /* default */ void testFactory1()
40     {
41      assertEquals(1, Weekday.of("MONDAY").getAction(), MONDAY_ACTION_NOT_AS_EXPECTED); //$NON-NLS-1$
42     }
43  
44  
45    /**
46     * Test getAction of Weekday.
47     */
48    @Test
49    /* default */ void testGetAction()
50     {
51      assertAll("getAction", //$NON-NLS-1$
52        () -> assertEquals(1, Weekday.MONDAY.getAction(), MONDAY_ACTION_NOT_AS_EXPECTED),
53        () -> assertEquals(2, Weekday.TUESDAY.getAction(), "2 action not as expected"), //$NON-NLS-1$
54        () -> assertEquals(3, Weekday.WEDNESDAY.getAction(), "3 action not as expected"), //$NON-NLS-1$
55        () -> assertEquals(4, Weekday.THURSDAY.getAction(), "4 action not as expected"), //$NON-NLS-1$
56        () -> assertEquals(5, Weekday.FRIDAY.getAction(), "5 action not as expected"), //$NON-NLS-1$
57        () -> assertEquals(6, Weekday.SATURDAY.getAction(), "6 action not as expected"), //$NON-NLS-1$
58        () -> assertEquals(7, Weekday.SUNDAY.getAction(), "7 action not as expected") //$NON-NLS-1$
59      );
60     }
61  
62  
63    /**
64     * Test stringValue.
65     */
66    @Test
67    /* default */ void testStringValue()
68     {
69      final Weekday wd = Weekday.MONDAY;
70      assertEquals("MONDAY", wd.stringValue(), "stringValue not as expected");
71     }
72  
73  
74   }