|
1 |
| -/* |
2 |
| - * Copyright (C) 2011 Everit Kft. (http://www.everit.org) |
3 |
| - * |
4 |
| - * Licensed under the Apache License, Version 2.0 (the "License"); |
5 |
| - * you may not use this file except in compliance with the License. |
6 |
| - * You may obtain a copy of the License at |
7 |
| - * |
8 |
| - * http://www.apache.org/licenses/LICENSE-2.0 |
9 |
| - * |
10 |
| - * Unless required by applicable law or agreed to in writing, software |
11 |
| - * distributed under the License is distributed on an "AS IS" BASIS, |
12 |
| - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 |
| - * See the License for the specific language governing permissions and |
14 |
| - * limitations under the License. |
15 |
| - */ |
16 | 1 | package org.everit.json.schema;
|
17 | 2 |
|
18 | 3 | import static org.everit.json.schema.ObjectComparator.deepEquals;
|
19 | 4 | import static org.everit.json.schema.TestSupport.buildWithLocation;
|
| 5 | +import static org.junit.Assert.assertEquals; |
| 6 | +import static org.junit.Assert.assertNull; |
20 | 7 | import static org.junit.Assert.assertTrue;
|
21 | 8 |
|
22 | 9 | import java.util.Optional;
|
@@ -178,4 +165,19 @@ public void requiresString_nullable() {
|
178 | 165 | Schema subject = StringSchema.builder().requiresString(true).nullable(true).build();
|
179 | 166 | subject.validate(JSONObject.NULL);
|
180 | 167 | }
|
| 168 | + |
| 169 | + @Test |
| 170 | + public void getConvertedPattern() { |
| 171 | + StringSchema subject = StringSchema.builder().pattern("my\\\\/[p]a[tt]ern").build(); |
| 172 | + assertEquals("my\\\\/[p]a[tt]ern", subject.getRE2JPattern().toString()); |
| 173 | + assertEquals("my\\\\/[p]a[tt]ern", subject.getPattern().toString()); |
| 174 | + } |
| 175 | + |
| 176 | + @Test |
| 177 | + public void getConvertedNullPattern() { |
| 178 | + StringSchema subject = StringSchema.builder().build(); |
| 179 | + assertNull(subject.getRE2JPattern()); |
| 180 | + assertNull(subject.getPattern()); |
| 181 | + } |
| 182 | + |
181 | 183 | }
|
0 commit comments