Package com.avaje.tests.basic

Source Code of com.avaje.tests.basic.TestSaveDeleteOneToOneMultiple

package com.avaje.tests.basic;

import org.junit.Assert;
import org.junit.Test;

import com.avaje.ebean.BaseTestCase;
import com.avaje.ebean.Ebean;
import com.avaje.tests.model.basic.PFile;
import com.avaje.tests.model.basic.PFileContent;

public class TestSaveDeleteOneToOneMultiple extends BaseTestCase {

//  public void testCreateDeletePFile() {
//    PFile persistentFile = new PFile("test.txt",
//        new PFileContent("test".getBytes()));
//
//    Ebean.save(persistentFile);
//    Ebean.delete(persistentFile);
//  }

  @Test
  public void testCreateLoadDeletePFile() {
    PFile persistentFile = new PFile("test.txt",
        new PFileContent("test".getBytes()));

    Ebean.save(persistentFile);

    persistentFile = Ebean.find(PFile.class, persistentFile.getId());
   
    PFileContent persistentFileContent = persistentFile.getFileContent();
   
    Assert.assertNotNull(persistentFileContent);
   
    Assert.assertNotNull("load byte content", persistentFileContent.getContent());
   
    Ebean.delete(persistentFile);
  }
}
TOP

Related Classes of com.avaje.tests.basic.TestSaveDeleteOneToOneMultiple

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.