1+ /*
2+ * This project is licensed under the MIT license. Module model-view-viewmodel is using ZK framework licensed under LGPL (see lgpl-3.0.txt).
3+ *
4+ * The MIT License
5+ * Copyright © 2014-2022 Ilkka Seppälä
6+ *
7+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8+ * of this software and associated documentation files (the "Software"), to deal
9+ * in the Software without restriction, including without limitation the rights
10+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+ * copies of the Software, and to permit persons to whom the Software is
12+ * furnished to do so, subject to the following conditions:
13+ *
14+ * The above copyright notice and this permission notice shall be included in
15+ * all copies or substantial portions of the Software.
16+ *
17+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23+ * THE SOFTWARE.
24+ */
25+ package com .iluwatar .sessionserver ;
26+
27+ import static java .lang .Thread .State ;
28+ import static java .lang .Thread .State .WAITING ;
29+ import static org .junit .jupiter .api .Assertions .assertEquals ;
30+ import static org .mockito .Mockito .when ;
31+
32+ import com .sun .net .httpserver .Headers ;
33+ import com .sun .net .httpserver .HttpExchange ;
34+ import java .io .ByteArrayOutputStream ;
35+ import java .io .IOException ;
36+ import java .time .Instant ;
37+ import java .util .HashMap ;
38+ import java .util .Map ;
39+ import lombok .extern .slf4j .Slf4j ;
40+ import org .junit .jupiter .api .BeforeEach ;
41+ import org .junit .jupiter .api .Test ;
42+ import org .mockito .Mock ;
43+ import org .mockito .MockitoAnnotations ;
44+
45+ /**
46+ * LoginHandlerTest.
47+ */
48+ @ Slf4j
49+ public class AppTest {
50+
51+ private LoginHandler loginHandler ;
52+ //private Headers headers;
53+ private Map <String , Integer > sessions ;
54+ private Map <String , Instant > sessionCreationTimes ;
55+
56+ @ Mock
57+ private HttpExchange exchange ;
58+
59+ /**
60+ * Setup tests.
61+ */
62+ @ BeforeEach
63+ public void setUp () throws IOException {
64+ MockitoAnnotations .initMocks (this );
65+ App .main (new String [] {});
66+ }
67+
68+ @ Test
69+ public void expirationTaskStartStateTest () {
70+
71+ //assert
72+ LOGGER .info ("Expiration Task Status: " +String .valueOf (App .getExpirationTaskState ()));
73+ assertEquals (App .getExpirationTaskState (),WAITING );
74+
75+ }
76+
77+ }
0 commit comments