commit
dbbaecf5a1
@ -4,6 +4,7 @@ import org.junit.Test;
|
|||||||
|
|
||||||
import java.time.OffsetDateTime;
|
import java.time.OffsetDateTime;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.TimeZone;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
@ -18,12 +19,19 @@ public class ConvertToOffsetDateTimeUnitTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenDate_whenHasOffset_thenConvertWithOffset() {
|
public void givenDate_whenHasOffset_thenConvertWithOffset() {
|
||||||
|
TimeZone prevTimezone = TimeZone.getDefault();
|
||||||
|
TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
|
||||||
|
|
||||||
Date date = new Date();
|
Date date = new Date();
|
||||||
date.setHours(6);
|
date.setHours(6);
|
||||||
date.setMinutes(30);
|
date.setMinutes(30);
|
||||||
|
|
||||||
OffsetDateTime odt = ConvertToOffsetDateTime.convert(date, 3, 30);
|
OffsetDateTime odt = ConvertToOffsetDateTime.convert(date, 3, 30);
|
||||||
assertEquals(10, odt.getHour());
|
assertEquals(10, odt.getHour());
|
||||||
assertEquals(0, odt.getMinute());
|
assertEquals(0, odt.getMinute());
|
||||||
|
|
||||||
|
// Reset the timezone to its original value to prevent side effects
|
||||||
|
TimeZone.setDefault(prevTimezone);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
4
pom.xml
4
pom.xml
@ -642,7 +642,6 @@
|
|||||||
<module>spring-boot-modules</module>
|
<module>spring-boot-modules</module>
|
||||||
<module>spring-boot-admin</module>
|
<module>spring-boot-admin</module>
|
||||||
<module>spring-boot-angular</module>
|
<module>spring-boot-angular</module>
|
||||||
<module>spring-boot-artifacts</module>
|
|
||||||
<module>spring-boot-autoconfiguration</module>
|
<module>spring-boot-autoconfiguration</module>
|
||||||
<module>spring-boot-bootstrap</module>
|
<module>spring-boot-bootstrap</module>
|
||||||
<module>spring-boot-camel</module>
|
<module>spring-boot-camel</module>
|
||||||
@ -653,7 +652,6 @@
|
|||||||
<module>spring-boot-ctx-fluent</module>
|
<module>spring-boot-ctx-fluent</module>
|
||||||
<module>spring-boot-custom-starter</module>
|
<module>spring-boot-custom-starter</module>
|
||||||
<module>spring-boot-deployment</module>
|
<module>spring-boot-deployment</module>
|
||||||
<module>spring-boot-di</module>
|
|
||||||
<module>spring-boot-environment</module>
|
<module>spring-boot-environment</module>
|
||||||
<module>spring-boot-flowable</module>
|
<module>spring-boot-flowable</module>
|
||||||
<!-- <module>spring-boot-gradle</module> --> <!-- Not a maven project -->
|
<!-- <module>spring-boot-gradle</module> --> <!-- Not a maven project -->
|
||||||
@ -1177,7 +1175,6 @@
|
|||||||
<module>spring-boot-modules</module>
|
<module>spring-boot-modules</module>
|
||||||
<module>spring-boot-admin</module>
|
<module>spring-boot-admin</module>
|
||||||
<module>spring-boot-angular</module>
|
<module>spring-boot-angular</module>
|
||||||
<module>spring-boot-artifacts</module>
|
|
||||||
<module>spring-boot-autoconfiguration</module>
|
<module>spring-boot-autoconfiguration</module>
|
||||||
<module>spring-boot-bootstrap</module>
|
<module>spring-boot-bootstrap</module>
|
||||||
<module>spring-boot-camel</module>
|
<module>spring-boot-camel</module>
|
||||||
@ -1188,7 +1185,6 @@
|
|||||||
<module>spring-boot-ctx-fluent</module>
|
<module>spring-boot-ctx-fluent</module>
|
||||||
<module>spring-boot-custom-starter</module>
|
<module>spring-boot-custom-starter</module>
|
||||||
<module>spring-boot-deployment</module>
|
<module>spring-boot-deployment</module>
|
||||||
<module>spring-boot-di</module>
|
|
||||||
<module>spring-boot-environment</module>
|
<module>spring-boot-environment</module>
|
||||||
<module>spring-boot-flowable</module>
|
<module>spring-boot-flowable</module>
|
||||||
<!-- <module>spring-boot-gradle</module> --> <!-- Not a maven project -->
|
<!-- <module>spring-boot-gradle</module> --> <!-- Not a maven project -->
|
||||||
|
|||||||
@ -14,7 +14,9 @@
|
|||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
|
<module>spring-boot-artifacts</module>
|
||||||
<module>spring-boot-data</module>
|
<module>spring-boot-data</module>
|
||||||
|
<module>spring-boot-di</module>
|
||||||
<module>spring-boot-mvc-birt</module>
|
<module>spring-boot-mvc-birt</module>
|
||||||
<module>spring-boot-properties</module>
|
<module>spring-boot-properties</module>
|
||||||
<module>spring-boot-testing</module>
|
<module>spring-boot-testing</module>
|
||||||
|
|||||||
@ -11,7 +11,7 @@
|
|||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
<artifactId>parent-boot-2</artifactId>
|
<artifactId>parent-boot-2</artifactId>
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
<relativePath>../parent-boot-2</relativePath>
|
<relativePath>../../parent-boot-2</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@ -12,7 +12,7 @@
|
|||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
<artifactId>parent-boot-2</artifactId>
|
<artifactId>parent-boot-2</artifactId>
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
<relativePath>../parent-boot-2</relativePath>
|
<relativePath>../../parent-boot-2</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@ -30,7 +30,7 @@
|
|||||||
<module>spring-security-mvc-persisted-remember-me</module>
|
<module>spring-security-mvc-persisted-remember-me</module>
|
||||||
<module>spring-security-mvc-socket</module>
|
<module>spring-security-mvc-socket</module>
|
||||||
<module>spring-security-oidc</module>
|
<module>spring-security-oidc</module>
|
||||||
<!--<module>spring-security-react</module> --> <!-- Module broken, fixing in BAEL-20772 -->
|
<module>spring-security-react</module>
|
||||||
|
|
||||||
<module>spring-security-rest</module>
|
<module>spring-security-rest</module>
|
||||||
<module>spring-security-rest-basic-auth</module>
|
<module>spring-security-rest-basic-auth</module>
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -6,8 +6,10 @@ import org.junit.Test;
|
|||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||||
|
import org.springframework.test.context.web.WebAppConfiguration;
|
||||||
|
|
||||||
@RunWith(SpringJUnit4ClassRunner.class)
|
@RunWith(SpringJUnit4ClassRunner.class)
|
||||||
|
@WebAppConfiguration
|
||||||
@ContextConfiguration(classes = { MvcConfig.class, SecSecurityConfig.class })
|
@ContextConfiguration(classes = { MvcConfig.class, SecSecurityConfig.class })
|
||||||
public class SpringContextTest {
|
public class SpringContextTest {
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user