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));
}
}