More Cron test fixes

This commit is contained in:
Gary Russell
2020-08-03 16:51:55 -04:00
parent 2356324e9b
commit 0e2652fdf6
3 changed files with 4 additions and 8 deletions

View File

@@ -21,10 +21,10 @@ import static org.assertj.core.api.Assertions.assertThat;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.DirectFieldAccessor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.integration.scheduling.PollerMetadata;
import org.springframework.integration.test.util.TestUtils;
import org.springframework.scheduling.Trigger;
import org.springframework.scheduling.support.CronTrigger;
import org.springframework.test.context.ContextConfiguration;
@@ -47,10 +47,7 @@ public class CronTriggerParserTests {
PollerMetadata metadata = (PollerMetadata) poller;
Trigger trigger = metadata.getTrigger();
assertThat(trigger.getClass()).isEqualTo(CronTrigger.class);
DirectFieldAccessor accessor = new DirectFieldAccessor(trigger);
String expression = (String) new DirectFieldAccessor(
accessor.getPropertyValue("sequenceGenerator"))
.getPropertyValue("expression");
String expression = TestUtils.getPropertyValue(trigger, "expression.expression", String.class);
assertThat(expression).isEqualTo("*/10 * 9-17 * * MON-FRI");
}

View File

@@ -91,8 +91,7 @@ public class InboundChannelAdapterExpressionTests {
DirectFieldAccessor adapterAccessor = new DirectFieldAccessor(adapter);
Trigger trigger = TestUtils.getPropertyValue(adapter, "trigger", Trigger.class);
assertThat(trigger.getClass()).isEqualTo(CronTrigger.class);
assertThat(new DirectFieldAccessor(new DirectFieldAccessor(
trigger).getPropertyValue("sequenceGenerator")).getPropertyValue("expression"))
assertThat(TestUtils.getPropertyValue(trigger, "expression.expression"))
.isEqualTo("7 6 5 4 3 ?");
assertThat(adapterAccessor.getPropertyValue("outputChannel")).isEqualTo(this.context.getBean("cronChannel"));
Expression expression = TestUtils.getPropertyValue(adapter, "source.expression", Expression.class);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2019 the original author or authors.
* Copyright 2014-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.