    @Test
    public void testPeriodBegin() {

        Period p = Period.secondsOf(60);

        Calendar t1 = Calendar.getInstance();
        t1.set(Calendar.MILLISECOND, 999);
        t1.set(Calendar.SECOND, 59);

        Calendar t2 = Calendar.getInstance();
        t2.set(Calendar.MILLISECOND, 0);
        t2.set(Calendar.SECOND, 0);
        t2.add(Calendar.MINUTE, 1);

        Calendar begin = p.periodBegin(t1, 0);
        assert (begin.equals(p.periodBegin(t2, 0)) == false);
        assert (begin.equals(p.periodBegin(t2, 1)));

        t2.set(Calendar.MILLISECOND, 100);
        assert (begin.equals(p.periodBegin(t2, 100)) == false);
        assert (begin.equals(p.periodBegin(t2, 101)));

        t2.set(Calendar.MILLISECOND, 0);
        t2.set(Calendar.SECOND, 4);
        assert (begin.equals(p.periodBegin(t2, 4000)) == false);
        assert (begin.equals(p.periodBegin(t2, 4001)));
    }