forked from Karm/mandrel-integration-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add integration test for Calendar building.
Related to quarkusio/quarkus#36975
- Loading branch information
Showing
5 changed files
with
98 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright (c) 2023, Red Hat Inc. All rights reserved. | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* You may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
package calendar; | ||
|
||
import java.util.Calendar; | ||
import java.util.Locale; | ||
|
||
/** | ||
* @author Severin Gehwolf <[email protected]> | ||
*/ | ||
public class Main { | ||
|
||
private static void doCalTest(String type) { | ||
Calendar cal = new Calendar.Builder() | ||
.setCalendarType(type) | ||
.setFields(Calendar.YEAR, 1, Calendar.DAY_OF_YEAR, 1) | ||
.build(); | ||
int year = cal.get(Calendar.YEAR); | ||
String t = cal.getCalendarType(); | ||
int dayOfYear = cal.get(Calendar.DAY_OF_YEAR); | ||
System.out.printf("Year: %d, dayOfYear: %d, type: %s%n", year, dayOfYear, t); | ||
} | ||
|
||
public static void main(String[] args) { | ||
Locale.setDefault(Locale.US); // Don't rely on the default locale of the system. | ||
String[] types = new String[] { "japanese", "buddhist", "gregory" }; | ||
for (String t : types) { | ||
doCalTest(t); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters