pretty json test

This commit is contained in:
Adrian Cole 2012-05-21 03:03:08 -06:00
parent 997479f27a
commit 2fef9008eb
1 changed files with 8 additions and 0 deletions

View File

@ -34,6 +34,8 @@ import org.jclouds.ContextBuilder;
import org.jclouds.domain.LoginCredentials; import org.jclouds.domain.LoginCredentials;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.gson.Gson;
/** /**
* *
* <p/> * <p/>
@ -598,6 +600,12 @@ public class TemplateBuilderSpecTest {
assertTemplateBuilderEquivalence(expected, templateBuilders.get().from(spec)); assertTemplateBuilderEquivalence(expected, templateBuilders.get().from(spec));
} }
public void testNiceJson() {
TemplateBuilderSpec spec = parse("osFamily=UBUNTU,osVersionMatches=1[012].[01][04],imageNameMatches=.*w/ None.*");
assertEquals(new Gson().toJson(spec), "{\"imageNameMatches\":\".*w/ None.*\",\"osFamily\":\"UBUNTU\",\"osVersionMatches\":\"1[012].[01][04]\"}");
assertEquals(new Gson().fromJson(new Gson().toJson(spec), TemplateBuilderSpec.class), spec);
}
public void testParse_unknownKey() { public void testParse_unknownKey() {
try { try {
parse("foo=17"); parse("foo=17");