@@ -0,0 +1,3064 @@
+/*%0A * Copyright 2019, TeamDev. All rights reserved.%0A *%0A * Redistribution and use in source and/or binary forms, with or without%0A * modification, must retain the above copyright notice and the following%0A * disclaimer.%0A *%0A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS%0A * %22AS IS%22 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT%0A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR%0A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT%0A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,%0A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT%0A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,%0A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY%0A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT%0A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE%0A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.%0A */%0A%0Apackage io.spine.validate.rule;%0A%0Aimport com.google.common.truth.OptionalSubject;%0Aimport com.google.protobuf.Descriptors;%0Aimport io.spine.code.proto.FieldContext;%0Aimport io.spine.option.OptionsProto;%0Aimport io.spine.test.validate.rule.AField;%0Aimport io.spine.test.validate.rule.AMessage;%0Aimport org.junit.jupiter.api.DisplayName;%0Aimport org.junit.jupiter.api.Test;%0A%0Aimport static com.google.common.truth.Truth8.assertThat;%0A%0A@DisplayName(%22ValidationRuleOptions should%22)%0Afinal class ValidationRuleOptionsTest %7B%0A%0A    @DisplayName(%22retrieve option value from context%22)%0A    @Test%0A    void retrieveOptionValue() %7B%0A        FieldContext targetContext = FieldContext.create(AMessage.getDescriptor()%0A                                                                 .getFields()%0A                                                                 .get(0));%0A        Descriptors.FieldDescriptor nameField = AField.getDescriptor()%0A                                                      .getFields()%0A                                                      .get(0);%0A        FieldContext context = targetContext.forChild(nameField);%0A        OptionalSubject subject =%0A                assertThat(ValidationRuleOptions.getOptionValue(context, OptionsProto.required));%0A        subject.isPresent();%0A        subject.hasValue(true);%0A    %7D%0A%0A    @DisplayName(%22return empty for field without options%22)%0A    @Test%0A    void returnEmptyForNonExistingRuleOptions() %7B%0A%0A        FieldContext targetContext = FieldContext.create(AMessage.getDescriptor()%0A                                                                 .getFields()%0A                                                                 .get(0));%0A        Descriptors.FieldDescriptor addressField = AField.getDescriptor()%0A                                                         .getFields()%0A                                                         .get(3);%0A        FieldContext context = targetContext.forChild(addressField);%0A        assertThat(ValidationRuleOptions.getOptionValue(context, OptionsProto.required)).isEmpty();%0A    %7D%0A%7D%0A

Add validation rule options test