class UserNotification extends Model {

    public static UserNotification lastCalibrationAlert() {
        return new Select()
                .from(UserNotification.class)
                .where("calibration_alert = ?", true)
                .orderBy("_ID desc")
                .executeSingle();
    }

}

class UserNotificationTest extends Model {

    @Test
    public void lastCalibrationAlert() {

        // :: Setup
        UserNotification.create("test1", "calibration_alert", System.currentTimeMillis());
        UserNotification.create("test2", "calibration_alert", System.currentTimeMillis());

        // :: Act
        UserNotification userNotification = UserNotification.lastCalibrationAlert();

        // :: Verify
        assertThat(userNotification.calibration_alert).isTrue();
        assertThat(userNotification.message).isEqualTo("test2");
    }

}