Package org.joda.time

Examples of org.joda.time.DateMidnight


        AutoDiscoveredExcludedDao.class.getName() + " must have been skipped");
  }

  @Test
  public void testDao() {
    final Book book = new Book("AutoDiscoveredDaoTest", new DateMidnight());
    sessionFactory.getCurrentSession().save(book);
    final List<Book> books = dao.findBooks();
    Assert.assertEquals(books, Collections.singleton(book));
  }
View Full Code Here


  @Resource
  private SessionFactory sessionFactory;

  @Test
  public void testDao() {
    final Book book = new Book("SpringNamespaceTest", new DateMidnight());
    sessionFactory.getCurrentSession().save(book);
    final List<Book> books = dao.findBooks();
    Assert.assertEquals(books, Collections.singleton(book));
  }
View Full Code Here

  @Resource
  private SessionFactory sessionFactory;

  @Test
  public void testJoda() {
    final DateMidnight date = new DateMidnight(1970, 1, 1);
    final Book book = new Book("SpringNamespaceTest", date);
    dao.create(book);
    Assert.assertEquals(dao.findByPublishDate(date), Arrays.asList(book));
  }
View Full Code Here

    Assert.assertEquals(dao.findByPublishDate(date), Arrays.asList(book));
  }

  @Test
  public void testCrud() {
    final Book b = new Book("Crud", new DateMidnight());
    dao.create(b);
    Assert.assertTrue(sessionFactory.getCurrentSession().contains(b));
    dao.update(b);
    Assert.assertTrue(sessionFactory.getCurrentSession().contains(b));
    Assert.assertSame(b, dao.get(b.getPrimaryKey()));
View Full Code Here

    Assert.assertNull(dao.get(b.getPrimaryKey()));
  }

  @Test
  public void testSaveOrUpdate() {
    final Book b = new Book("SaveOrUpdate", new DateMidnight());
    dao.saveOrUpdate(b);
    Assert.assertTrue(sessionFactory.getCurrentSession().contains(b));
    Assert.assertSame(b, dao.get(b.getPrimaryKey()));
    dao.delete(b);
  }
View Full Code Here

    dao.delete(b);
  }

  @Test
  public void testDao() {
    final Book book = new Book("SpringNamespaceTest", new DateMidnight());
    dao.create(book);
    final Set<Book> books = dao.findAll();
    Assert.assertEquals(books, Collections.singleton(book));
    final Book byTitle = dao.findByTitle("SpringNamespaceTest");
    Assert.assertEquals(byTitle, book);
View Full Code Here

    Assert.assertEquals(byTitle, book);
  }

  @Test
  public void testLimitOffset() {
    final Book b1 = new Book("_aaa", new DateMidnight());
    dao.create(b1);
    final Book b2 = new Book("_bbb", new DateMidnight());
    dao.create(b2);
    final Book b3 = new Book("_ccc", new DateMidnight());
    dao.create(b3);
    final List<Book> books = dao.findLimitOffset(1, 1);
    Assert.assertEquals(books, Arrays.asList(b2));
  }
View Full Code Here

    Assert.assertEquals(books, Arrays.asList(b2));
  }

  @Test
  public void testParameterList() {
    final Book b1 = new Book("param1", new DateMidnight());
    dao.create(b1);
    final Book b2 = new Book("param2", new DateMidnight());
    dao.create(b2);
    final Book b3 = new Book("param3", new DateMidnight());
    dao.create(b3);
    final List<Book> books1 = dao.findByIds(1, new long[] { b1.getPrimaryKey(), b2.getPrimaryKey() });
    Assert.assertEquals(books1, Arrays.asList(b1));
    final List<Book> books2 = dao.findByObjectIds(new Long[] { b1.getPrimaryKey(), b2.getPrimaryKey() });
    Assert.assertEquals(books2, Arrays.asList(b1, b2));
View Full Code Here

    @Test
    public void testCurrentDate()
            throws Exception
    {
        // current date is the time at midnight in the session time zone
        DateMidnight dateMidnight = new DateMidnight(session.getStartTime(), DateTimeZone.UTC).withZoneRetainFields(DATE_TIME_ZONE);
        assertFunction("CURRENT_DATE", toDate(dateMidnight.getMillis()));
    }
View Full Code Here

  }
 
  @Test
  public void timeZones() {
    LocalDate lt = new LocalDate(2000, 1, 1);
    DateMidnight dm = lt.toDateMidnight(DateTimeZone.UTC);
   
    Assert.assertEquals("2000-01-01T00:00:00.000Z", dm.toString());
  }
View Full Code Here

TOP

Related Classes of org.joda.time.DateMidnight

Copyright © 2018 www.massapicom. 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.