forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disabled test for application-scoped value extractors
See quarkusio#20375
- Loading branch information
Showing
1 changed file
with
57 additions
and
0 deletions.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
...us/hibernate/validator/test/valueextractor/ApplicationScopedCustomValueExtractorTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package io.quarkus.hibernate.validator.test.valueextractor; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import javax.enterprise.context.ApplicationScoped; | ||
import javax.inject.Inject; | ||
import javax.validation.ValidatorFactory; | ||
import javax.validation.constraints.NotBlank; | ||
import javax.validation.valueextraction.ExtractedValue; | ||
import javax.validation.valueextraction.ValueExtractor; | ||
|
||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.junit.jupiter.api.Disabled; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.test.QuarkusUnitTest; | ||
|
||
@Disabled("Reproduces https://github.com/quarkusio/quarkus/issues/20375, not yet fixed") | ||
public class ApplicationScopedCustomValueExtractorTest { | ||
|
||
@Inject | ||
ValidatorFactory validatorFactory; | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest test = new QuarkusUnitTest().setArchiveProducer(() -> ShrinkWrap | ||
.create(JavaArchive.class) | ||
.addClasses(TestBean.class, Container.class, ApplicationScopedContainerValueExtractor.class)); | ||
|
||
@Test | ||
public void testApplicationScopedCustomValueExtractor() { | ||
assertThat(validatorFactory.getValidator().validate(new TestBean())).hasSize(1); | ||
} | ||
|
||
public static class TestBean { | ||
public Container<@NotBlank String> constrainedContainer; | ||
|
||
public TestBean() { | ||
Container<String> invalidContainer = new Container<>(); | ||
invalidContainer.value = " "; | ||
|
||
this.constrainedContainer = invalidContainer; | ||
} | ||
} | ||
|
||
@ApplicationScoped | ||
public static class ApplicationScopedContainerValueExtractor | ||
implements ValueExtractor<Container<@ExtractedValue ?>> { | ||
|
||
@Override | ||
public void extractValues(Container<?> originalValue, ValueReceiver receiver) { | ||
receiver.value("someName", originalValue.value); | ||
} | ||
} | ||
|
||
} |