AAI-1523 Batch reformat aai-core
[aai/aai-common.git] / aai-core / src / test / java / org / onap / aai / util / FormatDateTest.java
1 /**
2  * ============LICENSE_START=======================================================
3  * org.onap.aai
4  * ================================================================================
5  * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *    http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.aai.util;
22
23 import java.time.zone.ZoneRulesException;
24
25 import org.junit.Assert;
26 import org.junit.Ignore;
27 import org.junit.Test;
28
29 @Ignore
30 public class FormatDateTest {
31
32     @Test(expected = IllegalArgumentException.class)
33     public void testExceptionThrownWhenInvalidPatternIsPassed() {
34         FormatDate formatDate = new FormatDate("XX/TT/GGGG");
35         formatDate.getDateTime();
36     }
37
38     @Test
39     public void correctPattern() {
40         FormatDate formatDate = new FormatDate("dd/mm/yyyy");
41         Assert.assertNotNull(formatDate.getDateTime());
42     }
43
44     @Test(expected = IllegalArgumentException.class)
45     public void invalidPattern() {
46         FormatDate formatDate = new FormatDate("XX/TT/GGGG", "GMT");
47         formatDate.getDateTime();
48     }
49
50     @Test(expected = ZoneRulesException.class)
51     public void invalidZone() {
52         FormatDate formatDate = new FormatDate("dd/mm/yyyy", "IST");
53         formatDate.getDateTime();
54     }
55
56     @Test(expected = IllegalArgumentException.class)
57     public void testExceptionThrownWhenInvalidPatternAndZoneIsPassed() {
58         FormatDate formatDate = new FormatDate("XX/TT/GGGG", "IST");
59         formatDate.getDateTime();
60     }
61
62     @Test
63     public void correctPatternAndZone() {
64         FormatDate formatDate = new FormatDate("dd/mm/yyyy", "GMT");
65         Assert.assertNotNull(formatDate.getDateTime());
66     }
67 }