Package org.slim3.json.test.issue66

Source Code of org.slim3.json.test.issue66.PersistentFieldsTest

package org.slim3.json.test.issue66;

import org.junit.Assert;
import org.junit.Test;
import org.slim3.tester.TestEnvironment;

import com.google.appengine.api.datastore.KeyFactory;
import com.google.apphosting.api.ApiProxy;

public class PersistentFieldsTest {
    @Test
    public void test() throws Exception{
        ApiProxy.setEnvironmentForCurrentThread(new TestEnvironment() {
            @Override
            public String getAppId() {
                return "slim3-gen";
            }
        });
        PersistentFieldsTestModel m = new PersistentFieldsTestModel();
        m.setValue(10);
        m.getRef().setKey(KeyFactory.createKey(meta.getKind(), "name"));
        System.out.println(meta.modelToJson(m));
        Assert.assertEquals("{" +
            "\"ref\":\"aglzbGltMy1nZW5yIwsSGVBlcnNpc3RlbnRGaWVsZHNUZXN0TW9kZWwiBG5hbWUM\"," +
            "\"value\":10}", meta.modelToJson(m));
    }
   
    private PersistentFieldsTestModelMeta meta = PersistentFieldsTestModelMeta.get();
}
TOP

Related Classes of org.slim3.json.test.issue66.PersistentFieldsTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.