Skip to content

Commit

Permalink
failing test for issue raphaeljolivet#61
Browse files Browse the repository at this point in the history
  • Loading branch information
Ats Uiboupin committed Nov 21, 2016
1 parent e4d4f0f commit eca1f3e
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
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);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export interface TestClassWithJsonFormatFields {
_XMLGregorianCalendar: number;
_XMLGregorianCalendarAsString: number;
}

0 comments on commit eca1f3e

Please sign in to comment.