Search in sources :

Example 1 with ReactiveEntityCallbacks

use of org.springframework.data.mapping.callback.ReactiveEntityCallbacks in project spring-data-mongodb by spring-projects.

the class ReactiveMongoTemplateUnitTests method setterForEntityCallbackOverridesContextInitializedOnes.

// DATAMONGO-2261
@Test
void setterForEntityCallbackOverridesContextInitializedOnes() {
    ApplicationContext ctx = new StaticApplicationContext();
    template.setApplicationContext(ctx);
    ReactiveEntityCallbacks callbacks = ReactiveEntityCallbacks.create();
    template.setEntityCallbacks(callbacks);
    Assertions.assertThat(ReflectionTestUtils.getField(template, "entityCallbacks")).isSameAs(callbacks);
}
Also used : StaticApplicationContext(org.springframework.context.support.StaticApplicationContext) ApplicationContext(org.springframework.context.ApplicationContext) ReactiveEntityCallbacks(org.springframework.data.mapping.callback.ReactiveEntityCallbacks) StaticApplicationContext(org.springframework.context.support.StaticApplicationContext) Test(org.junit.jupiter.api.Test)

Example 2 with ReactiveEntityCallbacks

use of org.springframework.data.mapping.callback.ReactiveEntityCallbacks in project spring-data-mongodb by spring-projects.

the class ReactiveMongoTemplateUnitTests method setterForApplicationContextShouldNotOverrideAlreadySetEntityCallbacks.

// DATAMONGO-2261
@Test
void setterForApplicationContextShouldNotOverrideAlreadySetEntityCallbacks() {
    ReactiveEntityCallbacks callbacks = ReactiveEntityCallbacks.create();
    ApplicationContext ctx = new StaticApplicationContext();
    template.setEntityCallbacks(callbacks);
    template.setApplicationContext(ctx);
    Assertions.assertThat(ReflectionTestUtils.getField(template, "entityCallbacks")).isSameAs(callbacks);
}
Also used : StaticApplicationContext(org.springframework.context.support.StaticApplicationContext) ApplicationContext(org.springframework.context.ApplicationContext) ReactiveEntityCallbacks(org.springframework.data.mapping.callback.ReactiveEntityCallbacks) StaticApplicationContext(org.springframework.context.support.StaticApplicationContext) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)2 ApplicationContext (org.springframework.context.ApplicationContext)2 StaticApplicationContext (org.springframework.context.support.StaticApplicationContext)2 ReactiveEntityCallbacks (org.springframework.data.mapping.callback.ReactiveEntityCallbacks)2