Package org.yaac.shared.property

Source Code of org.yaac.shared.property.ListPropertyInfoTest

package org.yaac.shared.property;

import static org.junit.Assert.assertEquals;

import org.junit.Test;
import org.yaac.server.util.AutoBeanUtil;
import org.yaac.shared.egql.ResultCell;

/**
* @author Max Zhu (thebbsky@gmail.com)
*
*/
public class ListPropertyInfoTest {

  @Test
  public void testEncodeDecode() {
    ListPropertyInfo listInfo = new ListPropertyInfo();
   
    KeyInfo key1 = new KeyInfo(null, "kkk", null, 20L, "keyString");
    KeyInfo key2 = new KeyInfo(key1, "fff", null, 201L, "keyString");
    listInfo.add(key2);
   
    BlobKeyPropertyInfo blob = new BlobKeyPropertyInfo("downloadpath");
    listInfo.add(blob);
   
    ResultCell cell = listInfo.populateResultCell(AutoBeanUtil.getResultCellFactory());
   
    assertEquals(listInfo, PropertyInfo.Builder.fromResultCell(cell));
  }

  @Test
  public void testAsExpression() {
    assertEquals("list(true,email('a@b.c'),'abc')", new ListPropertyInfo().add(
        new BooleanPropertyInfo(true))
        .add(new EmailPropertyInfo("a@b.c"))
        .add(new StringPropertyInfo("abc"))
        .asExpression(null))
  }
}
TOP

Related Classes of org.yaac.shared.property.ListPropertyInfoTest

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.