File tree Expand file tree Collapse file tree
main/java/com/github/tomakehurst/wiremock/extension/responsetemplating/helpers
test/java/com/github/tomakehurst/wiremock/extension/responsetemplating/helpers Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11/*
2- * Copyright (C) 2018-2021 Thomas Akehurst
2+ * Copyright (C) 2018-2024 Thomas Akehurst
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
1515 */
1616package com .github .tomakehurst .wiremock .extension .responsetemplating .helpers ;
1717
18+ import com .fasterxml .jackson .annotation .JsonValue ;
1819import com .fasterxml .jackson .databind .util .ISO8601Utils ;
1920import java .text .SimpleDateFormat ;
2021import java .time .ZoneId ;
@@ -42,6 +43,7 @@ public ZoneId getTimezone() {
4243 }
4344
4445 @ Override
46+ @ JsonValue
4547 public String toString () {
4648 if (format != null ) {
4749 if (format .equals ("epoch" )) {
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (C) 2024 Thomas Akehurst
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+ package com .github .tomakehurst .wiremock .extension .responsetemplating .helpers ;
17+
18+ import static org .hamcrest .MatcherAssert .assertThat ;
19+ import static org .hamcrest .Matchers .is ;
20+
21+ import com .github .tomakehurst .wiremock .common .Json ;
22+ import java .util .Date ;
23+ import org .junit .jupiter .api .Test ;
24+
25+ public class RenderableDateTest {
26+
27+ @ Test
28+ void writesToJsonInStringFormat () {
29+ RenderableDate renderableDate = new RenderableDate (new Date (1729266504000L ), null , null );
30+ assertThat (Json .write (renderableDate ), is ("\" 2024-10-18T15:48:24Z\" " ));
31+ }
32+ }
You can’t perform that action at this time.
0 commit comments