mirror of https://github.com/apache/jclouds.git
pretty json test
This commit is contained in:
parent
997479f27a
commit
2fef9008eb
|
@ -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");
|
||||||
|
|
Loading…
Reference in New Issue