-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into Issue-#2196
- Loading branch information
Showing
3 changed files
with
79 additions
and
3 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
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
45 changes: 45 additions & 0 deletions
45
platform-dao/src/test/java/ua/com/fielden/platform/domain/testing/DateCreationTest.java
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,45 @@ | ||
package ua.com.fielden.platform.domain.testing; | ||
|
||
import org.joda.time.DateTime; | ||
import org.junit.Test; | ||
import ua.com.fielden.platform.test_config.AbstractDaoTestCase; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertTrue; | ||
import static ua.com.fielden.platform.entity.query.fluent.EntityQueryUtils.from; | ||
import static ua.com.fielden.platform.entity.query.fluent.EntityQueryUtils.select; | ||
|
||
/** | ||
* A test case for date creation using {@link AbstractDaoTestCase#date(String)}. | ||
* | ||
* @author TG Team | ||
* | ||
*/ | ||
public class DateCreationTest extends AbstractDaoTestCase { | ||
|
||
@Test | ||
public void can_create_dates_from_string_with_time_without_minutes() { | ||
assertEquals(new DateTime("2024-04-27T12:30:00.000").toDate(), date("2024-04-27 12:30")); | ||
} | ||
|
||
@Test | ||
public void can_create_dates_from_string_with_time_without_millis() { | ||
assertEquals(new DateTime("2024-04-27T12:30:05.000").toDate(), date("2024-04-27 12:30:05")); | ||
} | ||
|
||
@Test | ||
public void can_create_dates_from_string_with_time_with_millis() { | ||
assertEquals(new DateTime("2024-04-27T12:30:05.501").toDate(), date("2024-04-27 12:30:05.501")); | ||
assertEquals(new DateTime("2024-04-27T12:30:05.010").toDate(), date("2024-04-27 12:30:05.010")); | ||
} | ||
|
||
@Test | ||
public void can_create_dates_from_string_without_time() { | ||
assertEquals(new DateTime("2024-04-27T00:00:00").toDate(), date("2024-04-27")); | ||
} | ||
|
||
@Override | ||
protected void populateDomain() { | ||
// there is nothing to populate | ||
} | ||
} |