You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The @DirtiesContext annotation is a clue to the JUnit runner or @Rule that the test method needs some variation in its treatment.
With #56 it is possible to use different mix-in objects to run JUnit rules differently in different parts of the spec. However, making a single it have different behaviour to another is not possible. This is largely because under the hood all tests appear to relate to a stub @Test public void stub() {} method.
Perhaps it would be possible to fix this by one of two ways:
// provide annotated test methods in the MixinpublicclassMixin {
// rules stuff here@Test@InterestngAnnotation("1")
publicvoidinteresting1() {
}
@Test@InterestngAnnotation("2")
publicvoidinteresting2() {
}
}
// and then in the spec refer to themSupplier<Mixin> mixin = applyRules(Mixin.class);
describe("some suite", () -> {
it("uses the mixin a particular way", with(methodSetup("interesting1"), () -> {
// test something
}));
});
An alternative is to provide the method selection when applying the rules:
Supplier<Mixin> mixin = applyRules(Mixin.class, "interesting1");
describe("some suite", () -> {
it("uses the mixin a particular way", () -> {
// test something
});
});
More suggestions needed, I think.
The text was updated successfully, but these errors were encountered:
In native JUnit, you can do something like this:
The
@DirtiesContext
annotation is a clue to the JUnit runner or@Rule
that the test method needs some variation in its treatment.With #56 it is possible to use different mix-in objects to run JUnit rules differently in different parts of the spec. However, making a single
it
have different behaviour to another is not possible. This is largely because under the hood all tests appear to relate to a stub@Test public void stub() {}
method.Perhaps it would be possible to fix this by one of two ways:
An alternative is to provide the method selection when applying the rules:
More suggestions needed, I think.
The text was updated successfully, but these errors were encountered: