Commit 4a60e3cc authored by Dave Syer's avatar Dave Syer

Unignore condition tests

parent a4cb09c4
......@@ -16,6 +16,8 @@
package org.springframework.boot.autoconfigure.condition;
import java.util.Date;
import org.junit.Test;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
......@@ -45,6 +47,19 @@ public class ConditionalOnBeanTests {
assertEquals("bar", this.context.getBean("bar"));
}
@Test
public void testNameAndTypeOnBeanCondition() {
this.context.register(FooConfiguration.class,
OnBeanNameAndTypeConfiguration.class);
this.context.refresh();
/*
* Arguably this should be true, but as things are implemented the conditions
* specified in the different attributes of @ConditionalOnBean are combined with
* logical OR (not AND) so if any of them match the condition is true.
*/
assertFalse(this.context.containsBean("bar"));
}
@Test
public void testNameOnBeanConditionReverseOrder() {
this.context.register(OnBeanNameConfiguration.class, FooConfiguration.class);
......@@ -94,6 +109,15 @@ public class ConditionalOnBeanTests {
}
}
@Configuration
@ConditionalOnMissingBean(name = "foo", value = Date.class)
protected static class OnBeanNameAndTypeConfiguration {
@Bean
public String bar() {
return "bar";
}
}
@Configuration
@ConditionalOnBean(annotation = EnableScheduling.class)
protected static class OnAnnotationConfiguration {
......
......@@ -95,13 +95,13 @@ public class ConditionalOnClassTests {
}
@Configuration
@ImportResource("org/springframework/boot/context/foo.xml")
@ImportResource("org/springframework/boot/autoconfigure/condition/foo.xml")
protected static class XmlConfiguration {
}
@Configuration
@Import(BasicConfiguration.class)
@ImportResource("org/springframework/boot/context/foo.xml")
@ImportResource("org/springframework/boot/autoconfigure/condition/foo.xml")
protected static class CombinedXmlConfiguration {
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment