Skip to content

Commit

Permalink
Don't set default timezone to EST, but use the system one instead.
Browse files Browse the repository at this point in the history
  • Loading branch information
gbevin committed Sep 5, 2023
1 parent a48e7ef commit 29d6609
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/main/java/rife/config/RifeConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -1076,7 +1076,7 @@ public class ToolsConfig {
private String defaultResourceBundle_ = DEFAULT_RESOURCE_BUNDLE;
private String defaultLanguage_ = DEFAULT_DEFAULT_LANGUAGE;
private String defaultCountry_ = DEFAULT_DEFAULT_COUNTRY;
private TimeZone defaultTimeZone_ = DEFAULT_DEFAULT_TIMEZONE;
private TimeZone defaultTimeZone_ = null;
private String defaultShortDateFormat_;
private String defaultInputDateFormat_ = DEFAULT_INPUT_DATE_FORMAT;
private String defaultInputTimeFormat_ = DEFAULT_INPUT_TIME_FORMAT;
Expand All @@ -1087,7 +1087,6 @@ public class ToolsConfig {
public static final String DEFAULT_RESOURCE_BUNDLE = null;
public static final String DEFAULT_DEFAULT_LANGUAGE = "en";
public static final String DEFAULT_DEFAULT_COUNTRY = null;
public static final TimeZone DEFAULT_DEFAULT_TIMEZONE = TimeZone.getTimeZone("EST");
public static final String DEFAULT_INPUT_DATE_FORMAT = "yyyy-MM-dd HH:mm";
public static final String DEFAULT_INPUT_TIME_FORMAT = "HH:mm";
public static final int DEFAULT_MAX_VISUAL_URL_LENGTH = 70;
Expand Down
13 changes: 13 additions & 0 deletions src/test/java/rife/template/TestTemplate.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
*/
package rife.template;

import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import rife.config.RifeConfig;
import rife.template.exceptions.BlockUnknownException;
import rife.template.exceptions.TemplateException;
import rife.template.exceptions.ValueUnknownException;
Expand All @@ -18,6 +21,16 @@
import static org.junit.jupiter.api.Assertions.*;

public class TestTemplate {
@BeforeEach
public void setup() {
RifeConfig.tools().setDefaultTimeZone(TimeZone.getTimeZone("EST"));
}

@AfterEach
public void tearDown() {
RifeConfig.tools().setDefaultTimeZone(null);
}

@Test
void testInstantiation() {
var template = TemplateFactory.HTML.get("empty");
Expand Down
13 changes: 13 additions & 0 deletions src/test/java/rife/tools/TestArrayUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
*/
package rife.tools;

import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import rife.config.RifeConfig;
import rife.validation.ConstrainedProperty;
Expand All @@ -13,10 +15,21 @@
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;

import static org.junit.jupiter.api.Assertions.*;

public class TestArrayUtils {
@BeforeEach
public void setup() {
RifeConfig.tools().setDefaultTimeZone(TimeZone.getTimeZone("EST"));
}

@AfterEach
public void tearDown() {
RifeConfig.tools().setDefaultTimeZone(null);
}

@Test
void testGetArrayType() {
assertEquals(ArrayUtils.ArrayType.NO_ARRAY, ArrayUtils.getArrayType(new Object()));
Expand Down
12 changes: 12 additions & 0 deletions src/test/java/rife/tools/TestBeanUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
*/
package rife.tools;

import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import rife.config.RifeConfig;
import rife.tools.exceptions.BeanUtilsException;
Expand All @@ -19,6 +21,16 @@
import static org.junit.jupiter.api.Assertions.*;

public class TestBeanUtils {
@BeforeEach
public void setup() {
RifeConfig.tools().setDefaultTimeZone(TimeZone.getTimeZone("EST"));
}

@AfterEach
public void tearDown() {
RifeConfig.tools().setDefaultTimeZone(null);
}

private BeanImpl getPopulatedBean() {
BeanImpl bean = new BeanImpl();
var cal = RifeConfig.tools().getCalendarInstance(2002, Calendar.DECEMBER, 26, 22, 52, 31, 153);
Expand Down
12 changes: 12 additions & 0 deletions src/test/java/rife/tools/TestConvert.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
*/
package rife.tools;

import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import rife.config.RifeConfig;
import rife.tools.exceptions.ConversionException;
Expand All @@ -17,6 +19,16 @@
import static org.junit.jupiter.api.Assertions.*;

public class TestConvert {
@BeforeEach
public void setup() {
RifeConfig.tools().setDefaultTimeZone(TimeZone.getTimeZone("EST"));
}

@AfterEach
public void tearDown() {
RifeConfig.tools().setDefaultTimeZone(null);
}

@Test
void testToType()
throws ConversionException {
Expand Down

0 comments on commit 29d6609

Please sign in to comment.