@Test
  public void testMaximumSince() {
    item.setState(new DecimalType(1));
    HistoricItem historicItem =
        PersistenceExtensions.maximumSince(item, new DateMidnight(2012, 1, 1), "test");
    assertNotNull(historicItem);
    assertEquals("1", historicItem.getState().toString());

    historicItem = PersistenceExtensions.maximumSince(item, new DateMidnight(2005, 1, 1), "test");
    assertEquals("2012", historicItem.getState().toString());
    assertEquals(new DateMidnight(2012, 1, 1).toDate(), historicItem.getTimestamp());
  }
  @Test
  public void testHistoricState() {
    HistoricItem historicItem =
        PersistenceExtensions.historicState(item, new DateMidnight(2012, 1, 1), "test");
    assertEquals("2012", historicItem.getState().toString());

    historicItem =
        PersistenceExtensions.historicState(item, new DateMidnight(2011, 12, 31), "test");
    assertEquals("2011", historicItem.getState().toString());

    historicItem = PersistenceExtensions.historicState(item, new DateMidnight(2011, 1, 1), "test");
    assertEquals("2011", historicItem.getState().toString());

    historicItem = PersistenceExtensions.historicState(item, new DateMidnight(2000, 1, 1), "test");
    assertEquals("2000", historicItem.getState().toString());
  }