mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-18 21:20:45 +00:00
Merge branch 'feature/sprint-8-qqq-support-updates' into feature/sprint-8
This commit is contained in:
@ -27,14 +27,18 @@ import java.math.MathContext;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.time.Month;
|
||||
import java.time.ZoneOffset;
|
||||
import java.util.Calendar;
|
||||
import java.util.GregorianCalendar;
|
||||
import com.kingsrook.qqq.backend.core.exceptions.QValueException;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
@ -226,4 +230,24 @@ class ValueUtilsTest
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
@Test
|
||||
void testGetValueAsLocalTime() throws QValueException
|
||||
{
|
||||
assertNull(ValueUtils.getValueAsInstant(null));
|
||||
assertNull(ValueUtils.getValueAsInstant(""));
|
||||
assertNull(ValueUtils.getValueAsInstant(" "));
|
||||
assertEquals(LocalTime.of(10, 42), ValueUtils.getValueAsLocalTime(LocalTime.of(10, 42)));
|
||||
assertEquals(LocalTime.of(10, 42, 59), ValueUtils.getValueAsLocalTime(LocalTime.of(10, 42, 59)));
|
||||
assertEquals(LocalTime.of(10, 42), ValueUtils.getValueAsLocalTime("10:42"));
|
||||
assertEquals(LocalTime.of(10, 42, 59), ValueUtils.getValueAsLocalTime("10:42:59"));
|
||||
|
||||
assertThrows(QValueException.class, () -> ValueUtils.getValueAsInstant("a"));
|
||||
assertThrows(QValueException.class, () -> ValueUtils.getValueAsInstant("a,b"));
|
||||
assertThrows(QValueException.class, () -> ValueUtils.getValueAsInstant("1980/05/31"));
|
||||
assertThat(assertThrows(QValueException.class, () -> ValueUtils.getValueAsInstant(new Object())).getMessage()).contains("Unsupported class");
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user