Skip to content

Commit

Permalink
Fixed compatibility hints teardown
Browse files Browse the repository at this point in the history
  • Loading branch information
benfortuna committed Jul 29, 2021
1 parent f1b232e commit ba0f271
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 4 deletions.
Expand Up @@ -11,6 +11,11 @@ import java.nio.charset.Charset
*/
class CalendarBuilderSpec extends Specification {

def cleanup() {
CompatibilityHints.clearHintEnabled(CompatibilityHints.KEY_RELAXED_UNFOLDING)
CompatibilityHints.clearHintEnabled(CompatibilityHints.KEY_RELAXED_PARSING)
}

def 'test relaxed parsing'() {
given: 'a calendar object string'
String cal2 = getClass().getResource('test-relaxed-parsing.ics').text
Expand Down
Expand Up @@ -11,6 +11,10 @@ class ParameterBuilderTest extends Specification {
CompatibilityHints.setHintEnabled(CompatibilityHints.KEY_RELAXED_PARSING, false)
}

def cleanupSpec() {
CompatibilityHints.clearHintEnabled(CompatibilityHints.KEY_RELAXED_PARSING)
}

def 'test build parameter'() {
given: 'a parameter builder instance'
ParameterBuilder builder = [Arrays.asList(new Value.Factory())]
Expand Down
Expand Up @@ -11,6 +11,10 @@ import java.time.temporal.ChronoUnit

class TemporalAmountAdapterTest extends Specification {

def cleanup() {
CompatibilityHints.clearHintEnabled(CompatibilityHints.KEY_RELAXED_PARSING)
}

def "verify string representation"() {
setup: 'Set default seed date for test consistency'
def seed = LocalDateTime.parse("2021-04-01T00:00:00")
Expand Down
Expand Up @@ -8,6 +8,10 @@ class PrioritySpec extends Specification {

Priority.Factory factory = []

def cleanup() {
CompatibilityHints.clearHintEnabled(CompatibilityHints.KEY_RELAXED_PARSING)
}

def 'test factory use of constants'() {
when: 'factory is invoked with a constant value'
def priority = factory.createProperty(new ParameterList(), value)
Expand Down
8 changes: 6 additions & 2 deletions src/test/java/net/fortuna/ical4j/model/DateTimeTest.java
Expand Up @@ -99,6 +99,12 @@ protected void setUp() throws Exception {
CompatibilityHints.setHintEnabled(CompatibilityHints.KEY_RELAXED_PARSING, false);
}

@Override
protected void tearDown() throws Exception {
super.tearDown();
CompatibilityHints.clearHintEnabled(CompatibilityHints.KEY_RELAXED_PARSING);
}

/**
*
*/
Expand Down Expand Up @@ -140,8 +146,6 @@ public void testRelaxed() throws Exception {
assertEquals(this.expectedToString, dt.toString());
} catch (ParseException pe) {
fail("exception not expected with relaxed parsing is used");
} finally {
CompatibilityHints.clearHintEnabled(CompatibilityHints.KEY_RELAXED_PARSING);
}
}

Expand Down
Expand Up @@ -49,6 +49,13 @@ public class ParameterFactoryImplTest extends TestCase {

private Logger log = LoggerFactory.getLogger(ParameterFactoryImplTest.class);

@Override
protected void tearDown() throws Exception {
super.tearDown();

CompatibilityHints.clearHintEnabled(CompatibilityHints.KEY_RELAXED_PARSING);
}

/**
* @throws Exception
*/
Expand Down Expand Up @@ -89,7 +96,5 @@ public void testRelaxedParsing() throws Exception {
CompatibilityHints.setHintEnabled(CompatibilityHints.KEY_RELAXED_PARSING, true);

new ParameterFactoryImpl().createParameter("VVENUE", "My Place");

CompatibilityHints.clearHintEnabled(CompatibilityHints.KEY_RELAXED_PARSING);
}
}
Expand Up @@ -70,6 +70,12 @@ public CalendarComponentTest(String testMethod, CalendarComponent component,
this.component = component;
}

@Override
protected void tearDown() throws Exception {
super.tearDown();
CompatibilityHints.clearHintEnabled(CompatibilityHints.KEY_RELAXED_VALIDATION);
}

/**
* Test component iTIP METHOD validation.
*/
Expand Down
Expand Up @@ -131,6 +131,9 @@ public void setUp() throws Exception {
protected void tearDown() throws Exception {
// relax validation to avoid UID requirement..
CompatibilityHints.clearHintEnabled(CompatibilityHints.KEY_RELAXED_VALIDATION);
CompatibilityHints.clearHintEnabled(CompatibilityHints.KEY_RELAXED_PARSING);
CompatibilityHints.clearHintEnabled(CompatibilityHints.KEY_RELAXED_UNFOLDING);
CompatibilityHints.clearHintEnabled(CompatibilityHints.KEY_NOTES_COMPATIBILITY);
super.tearDown();
}

Expand Down

0 comments on commit ba0f271

Please sign in to comment.