Skip to content

Commit 0e2652f

Browse files
committed
More Cron test fixes
1 parent 2356324 commit 0e2652f

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

spring-integration-core/src/test/java/org/springframework/integration/config/xml/CronTriggerParserTests.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
import org.junit.Test;
2222
import org.junit.runner.RunWith;
2323

24-
import org.springframework.beans.DirectFieldAccessor;
2524
import org.springframework.beans.factory.annotation.Autowired;
2625
import org.springframework.context.ApplicationContext;
2726
import org.springframework.integration.scheduling.PollerMetadata;
27+
import org.springframework.integration.test.util.TestUtils;
2828
import org.springframework.scheduling.Trigger;
2929
import org.springframework.scheduling.support.CronTrigger;
3030
import org.springframework.test.context.ContextConfiguration;
@@ -47,10 +47,7 @@ public void checkConfigWithAttribute() {
4747
PollerMetadata metadata = (PollerMetadata) poller;
4848
Trigger trigger = metadata.getTrigger();
4949
assertThat(trigger.getClass()).isEqualTo(CronTrigger.class);
50-
DirectFieldAccessor accessor = new DirectFieldAccessor(trigger);
51-
String expression = (String) new DirectFieldAccessor(
52-
accessor.getPropertyValue("sequenceGenerator"))
53-
.getPropertyValue("expression");
50+
String expression = TestUtils.getPropertyValue(trigger, "expression.expression", String.class);
5451
assertThat(expression).isEqualTo("*/10 * 9-17 * * MON-FRI");
5552
}
5653

spring-integration-core/src/test/java/org/springframework/integration/config/xml/InboundChannelAdapterExpressionTests.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,7 @@ public void cron() {
9191
DirectFieldAccessor adapterAccessor = new DirectFieldAccessor(adapter);
9292
Trigger trigger = TestUtils.getPropertyValue(adapter, "trigger", Trigger.class);
9393
assertThat(trigger.getClass()).isEqualTo(CronTrigger.class);
94-
assertThat(new DirectFieldAccessor(new DirectFieldAccessor(
95-
trigger).getPropertyValue("sequenceGenerator")).getPropertyValue("expression"))
94+
assertThat(TestUtils.getPropertyValue(trigger, "expression.expression"))
9695
.isEqualTo("7 6 5 4 3 ?");
9796
assertThat(adapterAccessor.getPropertyValue("outputChannel")).isEqualTo(this.context.getBean("cronChannel"));
9897
Expression expression = TestUtils.getPropertyValue(adapter, "source.expression", Expression.class);

spring-integration-core/src/test/java/org/springframework/integration/configuration/EnableIntegrationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2019 the original author or authors.
2+
* Copyright 2014-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)