Package teammates.testing.junit.sample

Source Code of teammates.testing.junit.sample.FirstTest

package teammates.testing.junit.sample;

import static org.junit.Assert.*;

import java.util.List;

import javax.jdo.PersistenceManager;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import teammates.Courses;
import teammates.Datastore;
import teammates.jdo.Course;

import com.google.appengine.tools.development.testing.LocalDatastoreServiceTestConfig;
import com.google.appengine.tools.development.testing.LocalServiceTestHelper;

public class FirstTest {
  private final LocalServiceTestHelper helper = new LocalServiceTestHelper(new LocalDatastoreServiceTestConfig());

  @Before
  public void setUp() {
    helper.setUp();
  }

  @After
  public void tearDown() {
    helper.tearDown();
  }

  @Test
  public void simpleJdo() {
    Course a = new Course("cs1010", "test", "teammates.coord");
    Course b = new Course("CS1101", "Programming Methodology", "teammates.coord");

    Datastore.initialize();
    PersistenceManager pm = Datastore.getPersistenceManager();
    pm.makePersistent(a);
    pm.makePersistent(b);
   
    Courses courses = Courses.inst();
    List<Course> courseList = courses.getCoordinatorCourseList("teammates.coord");
    assertEquals(2, courseList.size());
   
  }
}
TOP

Related Classes of teammates.testing.junit.sample.FirstTest

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.