Beginning of a simple test related to codegen.

This commit is contained in:
Inderjeet Singh 2012-08-02 01:35:45 +00:00
parent 3be354eb76
commit 7d901d34fb
3 changed files with 65 additions and 2 deletions

View File

@ -82,8 +82,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
<source>1.6</source>
<target>1.6</target>
<compilerArgument>-proc:none</compilerArgument>
</configuration>
</plugin>

View File

@ -0,0 +1,26 @@
/*
* Copyright (C) 2012 Gson Authors.
*
* 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 com.google.gson.codegen.functional;
import junit.framework.TestCase;
public class CodeGenFunctionalTest extends TestCase {
public void testGeneratedJson() {
Order order = new Order("toy", 10);
// TODO: figure out how to access the generated type adapter
}
}

View File

@ -0,0 +1,37 @@
/*
* Copyright (C) 2012 Gson Authors.
*
* 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 com.google.gson.codegen.functional;
import com.google.gson.codegen.GeneratedTypeAdapter;
@GeneratedTypeAdapter
final class Order {
private final String itemName;
private final int price;
public Order(String itemName, int price) {
this.itemName = itemName;
this.price = price;
}
public String getItemName() {
return itemName;
}
public int getAmount() {
return price;
}
}