Hello,
I would like to make a slice test of kind @JsonTest. Something like this
@JsonTest
class MyJsonTest {
@Test
public void myTest() {
}
}
This simplified approach of writing a Json based unit test - in combination with spring-boot-cloud-task - is not feasible.
The whole Spring Cloud Task infrastructure is getting bootstrapped. And of course, it fails due to missing Task-Beans
In another attempt, I disabled any Spring Cloud Task feature toggle (e.g. spring.cloud.task.xxx.enabled=false) by extending @JsonTest(properties = {...} to no avail.
I am not sure if this problem is more related to Spring Boot slice test @JsonTest or Spring Cloud Task bootstrapping in general.
I use Spring Boot 2.7.16
Greetings
Comment From: wilkinsona
I am not sure if this problem is more related to Spring Boot slice test @JsonTest or Spring Cloud Task bootstrapping in general
Unfortunately, we only have limited bandwidth and it's hard to justify spending time triaging a problem that may not be ours to solve. This is particularly true when we have not been told how to reproduce the problem.
If you would like us to spend some more time investigating, please spend some time providing a complete yet minimal sample that reproduces the problem. You can share it with us by pushing it to a separate repository on GitHub or by zipping it up and attaching it to this issue.
Comment From: rfelgent
Hi @wilkinsona ,
of cource I can provide you with an example project: https://github.com/gvl-mbh/spring-boot-gh-38343/
Comment From: wilkinsona
Thank you. You need to move @EnableTask so that it isn't part of the sliced test. See https://docs.spring.io/spring-boot/docs/2.7.x/reference/htmlsingle/#features.testing.spring-boot-applications.user-configuration-and-slicing for further details.
Comment From: rfelgent
Hi @wilkinsona ,
my bad. Sorry for the stupid question/issue and thank you for your time!
As suggest, I moved the @EnabledTask to a dedicated configuration class and the slice test @JsonTest works like a charm (without bootstrapping spring cloud task stuff)