Skip to content

Fix eager context

Fix eager context #203

GitHub Actions / test report failed Apr 10, 2024 in 0s

32 passed, 4 failed and 0 skipped

Tests failed

Report Passed Failed Skipped Time
build/test-results/test/TEST-com.coditory.quark.context.BeanConditionsSpec.xml 5✅ 486ms
build/test-results/test/TEST-com.coditory.quark.context.BeanLifecycleSpec.xml 7✅ 189ms
build/test-results/test/TEST-com.coditory.quark.context.BeanResolutionSpec.xml 7✅ 2❌ 721ms
build/test-results/test/TEST-com.coditory.quark.context.EventBusRegistrationSpec.xml 4✅ 46ms
build/test-results/test/TEST-com.coditory.quark.context.events.ConfigurationEventEmissionSpec.xml 2✅ 2❌ 253ms
build/test-results/test/TEST-com.coditory.quark.context.events.ContextEventEmissionSpec.xml 4✅ 46ms
build/test-results/test/TEST-com.coditory.quark.context.PreconditionsSpec.xml 2✅ 13ms
build/test-results/test/TEST-com.coditory.quark.context.ThrowablesSpec.xml 1✅ 7ms

✅ build/test-results/test/TEST-com.coditory.quark.context.BeanConditionsSpec.xml

5 tests were completed in 486ms with 5 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
com.coditory.quark.context.BeanConditionsSpec 5✅ 486ms

✅ com.coditory.quark.context.BeanConditionsSpec

✅ should register bean with condition on a property
✅ should not register bean with condition on a missing property
✅ should register bean Foo when Bar -> Foo && Foo -> !Bar
✅ should register bean Foo, Bar, Baz when Bar -> Foo -> Baz -> prop(baz.enabled)
✅ should register Baz, Foo when Bar -> Foo -> Baz -> !Bar

✅ build/test-results/test/TEST-com.coditory.quark.context.BeanLifecycleSpec.xml

7 tests were completed in 189ms with 7 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
com.coditory.quark.context.BeanLifecycleSpec 7✅ 189ms

✅ com.coditory.quark.context.BeanLifecycleSpec

✅ should register beans and initialize them
✅ should finalize beans when closing the context
✅ should initialize eager beans after context is built
✅ should not initialize lazy beans that were not retrieved from the context
✅ should inject dependencies to lifecycle annotated methods
✅ should throw error when dependency for @Init annotated method is missing
✅ should throw error when dependency for @Close annotated method is missing

❌ build/test-results/test/TEST-com.coditory.quark.context.BeanResolutionSpec.xml

9 tests were completed in 721ms with 7 passed, 2 failed and 0 skipped.

Test suite Passed Failed Skipped Time
com.coditory.quark.context.BeanResolutionSpec 7✅ 2❌ 721ms

❌ com.coditory.quark.context.BeanResolutionSpec

✅ should retrieve named bean by type
✅ should fail registering multiple beans with the same name
✅ should retrieve unnamed bean by type when multiple named beans are registered
❌ should fail to retrieve bean by type when multiple named beans are registered
	Condition not satisfied:
❌ should fail to retrieve bean by type when multiple unnamed beans are registered
	Condition not satisfied:
✅ should retrieve named bean by type and name
✅ should not retrieve unnamed bean by name
✅ should not retrieve named bean by a different name
✅ should retrieve all named beans by type

✅ build/test-results/test/TEST-com.coditory.quark.context.EventBusRegistrationSpec.xml

4 tests were completed in 46ms with 4 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
com.coditory.quark.context.EventBusRegistrationSpec 4✅ 46ms

✅ com.coditory.quark.context.EventBusRegistrationSpec

✅ should not register event bus by default
✅ should register event bus when requested
✅ should subscribe handler annotated with @ContextEventHandler
✅ should not subscribe any handler

❌ build/test-results/test/TEST-com.coditory.quark.context.events.ConfigurationEventEmissionSpec.xml

4 tests were completed in 253ms with 2 passed, 2 failed and 0 skipped.

Test suite Passed Failed Skipped Time
com.coditory.quark.context.events.ConfigurationEventEmissionSpec 2✅ 2❌ 253ms

❌ com.coditory.quark.context.events.ConfigurationEventEmissionSpec

✅ should emit events when context is built
✅ should emit events when beans are resolved
❌ should emit events when context is closed
	Condition not satisfied:
❌ should emit events for Configuration beans when context is closed
	Condition not satisfied:

✅ build/test-results/test/TEST-com.coditory.quark.context.events.ContextEventEmissionSpec.xml

4 tests were completed in 46ms with 4 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
com.coditory.quark.context.events.ContextEventEmissionSpec 4✅ 46ms

✅ com.coditory.quark.context.events.ContextEventEmissionSpec

✅ should emit events when context is built
✅ should emit events when beans are resolved
✅ should emit events when context is closed
✅ should not emit context creation events to eventHandler registered as a bean

✅ build/test-results/test/TEST-com.coditory.quark.context.PreconditionsSpec.xml

2 tests were completed in 13ms with 2 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
com.coditory.quark.context.PreconditionsSpec 2✅ 13ms

✅ com.coditory.quark.context.PreconditionsSpec

✅ should fail non-null check
✅ should pass non-null check

✅ build/test-results/test/TEST-com.coditory.quark.context.ThrowablesSpec.xml

1 tests were completed in 7ms with 1 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
com.coditory.quark.context.ThrowablesSpec 1✅ 7ms

✅ com.coditory.quark.context.ThrowablesSpec

✅ should extract root cause of specific type or null

Annotations

Check failure on line 186 in src/main/java/com/coditory/quark/context/Context.java

See this annotation in the file changed.

@github-actions github-actions / test report

com.coditory.quark.context.BeanResolutionSpec ► should fail to retrieve bean by type when multiple named beans are registered

Failed test found in:
  build/test-results/test/TEST-com.coditory.quark.context.BeanResolutionSpec.xml
Error:
  Condition not satisfied:
Raw output
Condition not satisfied:

e.message == "Expected single bean: Bar. Got: 2"
| |       |
| |       false
| |       11 differences (73% similarity)
| |       Expected single bean: Bar. (F)o(und) 2( beans.)
| |       Expected single bean: Bar. (G)o(t:-) 2(-------)
| Expected single bean: Bar. Found 2 beans.
com.coditory.quark.context.ContextException: Expected single bean: Bar. Found 2 beans.
	at com.coditory.quark.context.Context.getOrNull(Context.java:186)
	at com.coditory.quark.context.Context.getOrNull(Context.java:134)
	at com.coditory.quark.context.BeanResolutionSpec.$spock_feature_0_3(BeanResolutionSpec.groovy:49)

	at com.coditory.quark.context.BeanResolutionSpec.should fail to retrieve bean by type when multiple named beans are registered(BeanResolutionSpec.groovy:52)

Check failure on line 186 in src/main/java/com/coditory/quark/context/Context.java

See this annotation in the file changed.

@github-actions github-actions / test report

com.coditory.quark.context.BeanResolutionSpec ► should fail to retrieve bean by type when multiple unnamed beans are registered

Failed test found in:
  build/test-results/test/TEST-com.coditory.quark.context.BeanResolutionSpec.xml
Error:
  Condition not satisfied:
Raw output
Condition not satisfied:

e.message == "Expected single bean: Bar. Got: 2"
| |       |
| |       false
| |       11 differences (73% similarity)
| |       Expected single bean: Bar. (F)o(und) 2( beans.)
| |       Expected single bean: Bar. (G)o(t:-) 2(-------)
| Expected single bean: Bar. Found 2 beans.
com.coditory.quark.context.ContextException: Expected single bean: Bar. Found 2 beans.
	at com.coditory.quark.context.Context.getOrNull(Context.java:186)
	at com.coditory.quark.context.Context.getOrNull(Context.java:134)
	at com.coditory.quark.context.BeanResolutionSpec.$spock_feature_0_4(BeanResolutionSpec.groovy:62)

	at com.coditory.quark.context.BeanResolutionSpec.should fail to retrieve bean by type when multiple unnamed beans are registered(BeanResolutionSpec.groovy:65)

Check failure on line 69 in src/test/groovy/com/coditory/quark/context/events/ConfigurationEventEmissionSpec.groovy

See this annotation in the file changed.

@github-actions github-actions / test report

com.coditory.quark.context.events.ConfigurationEventEmissionSpec ► should emit events when context is closed

Failed test found in:
  build/test-results/test/TEST-com.coditory.quark.context.events.ConfigurationEventEmissionSpec.xml
Error:
  Condition not satisfied:
Raw output
Condition not satisfied:

contextHandler.events == [ new ContextPreCloseEvent(), new BeanPreCloseEvent(descriptor(A)), new BeanPostCloseEvent(descriptor(A)), new BeanPreCloseEvent(descriptor(B)), new BeanPostCloseEvent(descriptor(B)), new BeanPreCloseEvent(descriptor(C)), new BeanPostCloseEvent(descriptor(C)), new ContextPostCloseEvent(), ]
|              |      |    |                           |                     |          |    |                      |          |    |                     |          |    |                      |          |    |                     |          |    |                      |          |    |
|              |      |    ContextPreCloseEvent[]      |                     |          |    |                      |          |    |                     |          |    |                      |          |    |                     |          |    |                      |          |    ContextPostCloseEvent[]
|              |      false                            |                     |          |    |                      |          |    |                     |          |    |                      |          |    |                     |          |    |                      |          class com.coditory.quark.context.events.ConfigurationEventEmissionSpec$C
|              |                                       |                     |          |    |                      |          |    |                     |          |    |                      |          |    |                     |          |    |                      BeanDescriptor{C}
|              |                                       |                     |          |    |                      |          |    |                     |          |    |                      |          |    |                     |          |    BeanPostCloseEvent[bean=BeanDescriptor{C}]
|              |                                       |                     |          |    |                      |          |    |                     |          |    |                      |          |    |                     |          class com.coditory.quark.context.events.ConfigurationEventEmissionSpec$C
|              |                                       |                     |          |    |                      |          |    |                     |          |    |                      |          |    |                     BeanDescriptor{C}
|              |                                       |                     |          |    |                      |          |    |                     |          |    |                      |          |    BeanPreCloseEvent[bean=BeanDescriptor{C}]
|              |                                       |                     |          |    |                      |          |    |                     |          |    |                      |          class com.coditory.quark.context.events.ConfigurationEventEmissionSpec$B
|              |                                       |                     |          |    |                      |          |    |                     |          |    |                      BeanDescriptor{B}
|              |                                       |                     |          |    |                      |          |    |                     |          |    BeanPostCloseEvent[bean=BeanDescriptor{B}]
|              |                                       |                     |          |    |                      |          |    |                     |          class com.coditory.quark.context.events.ConfigurationEventEmissionSpec$B
|              |                                       |                     |          |    |                      |          |    |                     BeanDescriptor{B}
|              |                                       |                     |          |    |                      |          |    BeanPreCloseEvent[bean=BeanDescriptor{B}]
|              |                                       |                     |          |    |                      |          class com.coditory.quark.context.events.ConfigurationEventEmissionSpec$A
|              |                                       |                     |          |    |                      BeanDescriptor{A}
|              |                                       |                     |          |    BeanPostCloseEvent[bean=BeanDescriptor{A}]
|              |                                       |                     |          class com.coditory.quark.context.events.ConfigurationEventEmissionSpec$A
|              |                                       |                     BeanDescriptor{A}
|              |                                       BeanPreCloseEvent[bean=BeanDescriptor{A}]
|              [ContextPreCloseEvent[], BeanPreCloseEvent[bean=BeanDescriptor{A}], BeanPostCloseEvent[bean=BeanDescriptor{A}], BeanPreCloseEvent[bean=BeanDescriptor{C}], BeanPostCloseEvent[bean=BeanDescriptor{C}], BeanPreCloseEvent[bean=BeanDescriptor{B}], BeanPostCloseEvent[bean=BeanDescriptor{B}], ContextPostCloseEvent[]]
<com.coditory.quark.context.events.ConfigurationEventEmissionSpec$SimpleHandler@2a8e30e3 this$0=com.coditory.quark.context.events.ConfigurationEventEmissionSpec@4f9980e1 events=[ContextPreCloseEvent[], BeanPreCloseEvent[bean=BeanDescriptor{A}], BeanPostCloseEvent[bean=BeanDescriptor{A}], BeanPreCloseEvent[bean=BeanDescriptor{C}], BeanPostCloseEvent[bean=BeanDescriptor{C}], BeanPreCloseEvent[bean=BeanDescriptor{B}], BeanPostCloseEvent[bean=BeanDescriptor{B}], ContextPostCloseEvent[]]>

	at com.coditory.quark.context.events.ConfigurationEventEmissionSpec.should emit events when context is closed(ConfigurationEventEmissionSpec.groovy:69)

Check failure on line 110 in src/test/groovy/com/coditory/quark/context/events/ConfigurationEventEmissionSpec.groovy

See this annotation in the file changed.

@github-actions github-actions / test report

com.coditory.quark.context.events.ConfigurationEventEmissionSpec ► should emit events for Configuration beans when context is closed

Failed test found in:
  build/test-results/test/TEST-com.coditory.quark.context.events.ConfigurationEventEmissionSpec.xml
Error:
  Condition not satisfied:
Raw output
Condition not satisfied:

contextHandler.events == [ new ContextPreCloseEvent(), new BeanPreCloseEvent(descriptor(SampleConfig)), new BeanPostCloseEvent(descriptor(SampleConfig)), new BeanPreCloseEvent(descriptor(A)), new BeanPostCloseEvent(descriptor(A)), new BeanPreCloseEvent(descriptor(B)), new BeanPostCloseEvent(descriptor(B)), new BeanPreCloseEvent(descriptor(C)), new BeanPostCloseEvent(descriptor(C)), new ContextPostCloseEvent(), ]
|              |      |    |                           |                     |          |               |                      |          |               |                     |          |    |                      |          |    |                     |          |    |                      |          |    |                     |          |    |                      |          |    |
|              |      |    ContextPreCloseEvent[]      |                     |          |               |                      |          |               |                     |          |    |                      |          |    |                     |          |    |                      |          |    |                     |          |    |                      |          |    ContextPostCloseEvent[]
|              |      false                            |                     |          |               |                      |          |               |                     |          |    |                      |          |    |                     |          |    |                      |          |    |                     |          |    |                      |          class com.coditory.quark.context.events.ConfigurationEventEmissionSpec$C
|              |                                       |                     |          |               |                      |          |               |                     |          |    |                      |          |    |                     |          |    |                      |          |    |                     |          |    |                      BeanDescriptor{C}
|              |                                       |                     |          |               |                      |          |               |                     |          |    |                      |          |    |                     |          |    |                      |          |    |                     |          |    BeanPostCloseEvent[bean=BeanDescriptor{C}]
|              |                                       |                     |          |               |                      |          |               |                     |          |    |                      |          |    |                     |          |    |                      |          |    |                     |          class com.coditory.quark.context.events.ConfigurationEventEmissionSpec$C
|              |                                       |                     |          |               |                      |          |               |                     |          |    |                      |          |    |                     |          |    |                      |          |    |                     BeanDescriptor{C}
|              |                                       |                     |          |               |                      |          |               |                     |          |    |                      |          |    |                     |          |    |                      |          |    BeanPreCloseEvent[bean=BeanDescriptor{C}]
|              |                                       |                     |          |               |                      |          |               |                     |          |    |                      |          |    |                     |          |    |                      |          class com.coditory.quark.context.events.ConfigurationEventEmissionSpec$B
|              |                                       |                     |          |               |                      |          |               |                     |          |    |                      |          |    |                     |          |    |                      BeanDescriptor{B}
|              |                                       |                     |          |               |                      |          |               |                     |          |    |                      |          |    |                     |          |    BeanPostCloseEvent[bean=BeanDescriptor{B}]
|              |                                       |                     |          |               |                      |          |               |                     |          |    |                      |          |    |                     |          class com.coditory.quark.context.events.ConfigurationEventEmissionSpec$B
|              |                                       |                     |          |               |                      |          |               |                     |          |    |                      |          |    |                     BeanDescriptor{B}
|              |                                       |                     |          |               |                      |          |               |                     |          |    |                      |          |    BeanPreCloseEvent[bean=BeanDescriptor{B}]
|              |                                       |                     |          |               |                      |          |               |                     |          |    |                      |          class com.coditory.quark.context.events.ConfigurationEventEmissionSpec$A
|              |                                       |                     |          |               |                      |          |               |                     |          |    |                      BeanDescriptor{A}
|              |                                       |                     |          |               |                      |          |               |                     |          |    BeanPostCloseEvent[bean=BeanDescriptor{A}]
|              |                                       |                     |          |               |                      |          |               |                     |          class com.coditory.quark.context.events.ConfigurationEventEmissionSpec$A
|              |                                       |                     |          |               |                      |          |               |                     BeanDescriptor{A}
|              |                                       |                     |          |               |                      |          |               BeanPreCloseEvent[bean=BeanDescriptor{A}]
|              |                                       |                     |          |               |                      |          class com.coditory.quark.context.events.ConfigurationEventEmissionSpec$SampleConfig
|              |                                       |                     |          |               |                      BeanDescriptor{SampleConfig}
|              |                                       |                     |          |               BeanPostCloseEvent[bean=BeanDescriptor{SampleConfig}]
|              |                                       |                     |          class com.coditory.quark.context.events.ConfigurationEventEmissionSpec$SampleConfig
|              |                                       |                     BeanDescriptor{SampleConfig}
|              |                                       BeanPreCloseEvent[bean=BeanDescriptor{SampleConfig}]
|              [ContextPreCloseEvent[], BeanPreCloseEvent[bean=BeanDescriptor{SampleConfig}], BeanPostCloseEvent[bean=BeanDescriptor{SampleConfig}], BeanPreCloseEvent[bean=BeanDescriptor{A}], BeanPostCloseEvent[bean=BeanDescriptor{A}], BeanPreCloseEvent[bean=BeanDescriptor{C}], BeanPostCloseEvent[bean=BeanDescriptor{C}], BeanPreCloseEvent[bean=BeanDescriptor{B}], BeanPostCloseEvent[bean=BeanDescriptor{B}], ContextPostCloseEvent[]]
<com.coditory.quark.context.events.ConfigurationEventEmissionSpec$SimpleHandler@16890f00 this$0=com.coditory.quark.context.events.ConfigurationEventEmissionSpec@b548f51 events=[ContextPreCloseEvent[], BeanPreCloseEvent[bean=BeanDescriptor{SampleConfig}], BeanPostCloseEvent[bean=BeanDescriptor{SampleConfig}], BeanPreCloseEvent[bean=BeanDescriptor{A}], BeanPostCloseEvent[bean=BeanDescriptor{A}], BeanPreCloseEvent[bean=BeanDescriptor{C}], BeanPostCloseEvent[bean=BeanDescriptor{C}], BeanPreCloseEvent[bean=BeanDescriptor{B}], BeanPostCloseEvent[bean=BeanDescriptor{B}], ContextPostCloseEvent[]]>

	at com.coditory.quark.context.events.ConfigurationEventEmissionSpec.should emit events for Configuration beans when context is closed(ConfigurationEventEmissionSpec.groovy:110)