Skip to content

Commit 4ef34dc

Browse files
committed
Add unit tests for util classes (DateTimeUtils, TimeZoneUtils)
1 parent b0a06a7 commit 4ef34dc

6 files changed

Lines changed: 754 additions & 580 deletions

File tree

src/main/java/microsoft/exchange/webservices/data/util/DateTimeUtils.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
package microsoft.exchange.webservices.data.util;
2525

26+
import org.apache.commons.lang3.StringUtils;
2627
import org.joda.time.format.DateTimeFormat;
2728
import org.joda.time.format.DateTimeFormatter;
2829

@@ -72,16 +73,16 @@ public static Date convertDateStringToDate(String value) {
7273
private static Date parseInternal(String value, boolean dateOnly) {
7374
String originalValue = value;
7475

75-
if (value == null || value.isEmpty()) {
76+
if (StringUtils.isEmpty(value)) {
7677
return null;
7778
} else {
7879
if (value.endsWith("z")) {
7980
// This seems to be an edge case. Let's uppercase the Z to be sure.
8081
value = value.substring(0, value.length() - 1) + "Z";
8182
}
8283

83-
DateTimeFormatter[] formats = dateOnly ? DATE_FORMATS : DATE_TIME_FORMATS;
84-
for (DateTimeFormatter format : formats) {
84+
final DateTimeFormatter[] formats = dateOnly ? DATE_FORMATS : DATE_TIME_FORMATS;
85+
for (final DateTimeFormatter format : formats) {
8586
try {
8687
return format.parseDateTime(value).toDate();
8788
} catch (IllegalArgumentException e) {

0 commit comments

Comments
 (0)