1515import io .swagger .v3 .oas .models .media .StringSchema ;
1616import org .testng .annotations .Test ;
1717
18+ import javax .validation .constraints .NotBlank ;
19+ import javax .validation .constraints .NotEmpty ;
20+ import javax .validation .constraints .NotNull ;
21+ import javax .validation .constraints .Size ;
1822import java .util .Date ;
1923import java .util .List ;
2024import java .util .Map ;
25+ import java .util .Set ;
2126
2227import static org .testng .Assert .assertEquals ;
2328import static org .testng .Assert .assertFalse ;
@@ -141,6 +146,37 @@ public void testIssue1743() {
141146 assertEquals (is .getEnum ().get (1 ), new Integer (2 ));
142147 }
143148
149+ @ Test
150+ public void testNotNullWithNotBlankAndNotEmpty () {
151+ final Map <String , Schema > models = ModelConverters .getInstance ().readAll (NotNullWithNotBlankNotEmptyModel .class );
152+ Schema model = models .get ("NotNullWithNotBlankNotEmptyModel" );
153+ assertTrue (model .getRequired ().contains ("notNullAndNotBlank" ));
154+ assertTrue (model .getRequired ().contains ("notNullAndNotEmptyList" ));
155+ assertTrue (model .getRequired ().contains ("notNullAndNotEmptySet" ));
156+ }
157+
158+ @ Test
159+ public void testCollectionWithNotEmpty () {
160+ final Map <String , Schema > models = ModelConverters .getInstance ().readAll (CollectionWithNotEmptyModel .class );
161+ Schema model = models .get ("CollectionWithNotEmptyModel" );
162+ ArraySchema listSchema = (ArraySchema ) model .getProperties ().get ("notEmptyList" );
163+ assertNotNull (listSchema );
164+ assertEquals (listSchema .getMinItems (), Integer .valueOf (1 ));
165+ ArraySchema setSchema = (ArraySchema ) model .getProperties ().get ("notEmptySet" );
166+ assertNotNull (setSchema );
167+ assertEquals (setSchema .getMinItems (), Integer .valueOf (1 ));
168+ }
169+
170+ @ Test
171+ public void testStringWithNotBlankAndSize () {
172+ final Map <String , Schema > models = ModelConverters .getInstance ().readAll (StringWithNotBlankAndSizeModel .class );
173+ Schema model = models .get ("StringWithNotBlankAndSizeModel" );
174+ Schema strSchema = (Schema ) model .getProperties ().get ("notBlankAndSized" );
175+ assertNotNull (strSchema );
176+ assertEquals (strSchema .getMinLength (), Integer .valueOf (5 ));
177+ assertEquals (strSchema .getMaxLength (), Integer .valueOf (10 ));
178+ }
179+
144180 class Family {
145181 public Date membersSince ;
146182 public List <Person > members ;
@@ -164,4 +200,32 @@ class IsModelTest {
164200 public Boolean is_happy ;
165201 public String name ;
166202 }
203+
204+ static class NotNullWithNotBlankNotEmptyModel {
205+ @ NotNull
206+ @ NotBlank
207+ public String notNullAndNotBlank ;
208+
209+ @ NotNull
210+ @ NotEmpty
211+ public List <String > notNullAndNotEmptyList ;
212+
213+ @ NotNull
214+ @ NotEmpty
215+ public Set <String > notNullAndNotEmptySet ;
216+ }
217+
218+ static class CollectionWithNotEmptyModel {
219+ @ NotEmpty
220+ public List <String > notEmptyList ;
221+
222+ @ NotEmpty
223+ public Set <String > notEmptySet ;
224+ }
225+
226+ static class StringWithNotBlankAndSizeModel {
227+ @ NotBlank
228+ @ Size (min = 5 , max = 10 )
229+ public String notBlankAndSized ;
230+ }
167231}
0 commit comments