Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1007299
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T08:35:50+00:00 2026-05-16T08:35:50+00:00

I am trying to get some basic unit tests up and running on the

  • 0

I am trying to get some basic unit tests up and running on the Play! framework using the Siena persistence library with GAE as the intended deployment target.

I have the project configured properly and can deploy the app to GAE. I created a basic domain object:

public class User extends Model {

    @Id(Generator.AUTO_INCREMENT)
    public Long id;

    @Column("first_name")
    public String firstName;

    @Column("last_name")
    public String lastName;

    @Column("email")
    public String email;

    public User(String firstName, String lastName, String email) {
        this.firstName = firstName;
        this.lastName = lastName;
        this.email = email;
    }

    public static Query<User> all() {
        return Model.all(User.class);
    }

}

and a basic unit test:

public class BasicTest extends UnitTest {

    @Before
    public void setup() {
        Fixtures.deleteAll();
    }


    @Test
    public void canCreateUser() {
        new User("Jason","Miesionczek","atmospherian@gmail.com").insert();

        User user = User.all().fetch().get(0);

        assertNotNull(user);
        assertEquals(1,User.all().count());
    }

}

I understand that in Play! 1.0.3, Fixtures support for Siena is not there yet, which should be fixed in 1.1, but in the mean time, what should i use instead of Fixtures.deleteAll() to clear the test db before each test?

Right now my second assertion fails because the database retains the previously inserted records.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T08:35:51+00:00Added an answer on May 16, 2026 at 8:35 am

    You would need to do a delete per table. E.g:

    Model.all(User.class).delete();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 522k
  • Answers 522k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Edit Design patterns like Command Query Responsibility Segregation (CQRS) specifically… May 16, 2026 at 9:28 pm
  • Editorial Team
    Editorial Team added an answer Before your document.ready call, put this line of code: var… May 16, 2026 at 9:28 pm
  • Editorial Team
    Editorial Team added an answer super() calls the parent constructor with no arguments. It can… May 16, 2026 at 9:28 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

Trying to get some basic drag/drop functionality happening for an iPhone application. My current
Trying to get some basic understanding of console functionalities. I am having issues so
I'm trying to do some basic queries using the groovy.sql.Sql object, and I'm getting
I have a repository class that defines some basic Get/Save/Delete methods. Inside these, I
I am trying to parse some very basic JSON, but I don't know where
I am trying to get my hands on Rspec2 with Rails3 (never used rspec
I'm trying to implement a basic MIME parser for the multipart/related in C++/Qt. So
I'm having this problem with validating a document that contains some basic PHP variables.
So I'm trying to convert myself to a more test- and behaviour- driven approach
I don't have much experience doing unit testing. From what I learned, code should

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.