forked from raphaeljolivet/java2typescript
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
failing test for issue raphaeljolivet#61
- Loading branch information
Ats Uiboupin
committed
Nov 21, 2016
1 parent
e4d4f0f
commit eca1f3e
Showing
2 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
java2typescript-jackson/src/test/java/java2typescript/jackson/module/JsonFormatTest.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,53 @@ | ||
/******************************************************************************* | ||
* Copyright 2013 Raphael Jolivet | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
******************************************************************************/ | ||
package java2typescript.jackson.module; | ||
|
||
import java.io.IOException; | ||
import java.io.StringWriter; | ||
import java.io.Writer; | ||
|
||
import javax.xml.datatype.XMLGregorianCalendar; | ||
|
||
import com.fasterxml.jackson.annotation.JsonFormat; | ||
import java2typescript.jackson.module.grammar.Module; | ||
import java2typescript.jackson.module.util.ExpectedOutputChecker; | ||
import java2typescript.jackson.module.util.TestUtil; | ||
import java2typescript.jackson.module.writer.ExternalModuleFormatWriter; | ||
import org.junit.Test; | ||
|
||
public class JsonFormatTest { | ||
|
||
class TestClassWithJsonFormatFields { | ||
public XMLGregorianCalendar _XMLGregorianCalendar; | ||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.sss'Z'", timezone = "GMT") | ||
public XMLGregorianCalendar _XMLGregorianCalendarAsString; | ||
} | ||
|
||
@Test | ||
public void classFieldsAnnotatedWithJsonFormat() throws IOException { | ||
// Arrange | ||
Module module = TestUtil.createTestModule(null, TestClassWithJsonFormatFields.class); | ||
Writer out = new StringWriter(); | ||
|
||
// Act | ||
new ExternalModuleFormatWriter().write(module, out); | ||
out.close(); | ||
System.out.println(out); | ||
|
||
// Assert | ||
ExpectedOutputChecker.checkOutputFromFile(out); | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
...ces/java2typescript/jackson/module/JsonFormatTest.classFieldsAnnotatedWithJsonFormat.d.ts
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,4 @@ | ||
export interface TestClassWithJsonFormatFields { | ||
_XMLGregorianCalendar: number; | ||
_XMLGregorianCalendarAsString: number; | ||
} |