testthat::test_that("MMBCV errors on missing required columns", { fake_fit <- list( cmap = matrix(1, nrow = 1, ncol = 1, dimnames = list("x", "1:2")), rmap = matrix(c(1, 1), ncol = 2), states = c("1", "2"), coefficients = 0 ) df <- data.frame(Tstart = 0, Tstop = 1, clus_id = 1, state = 2, x = 0.1) expect_error( MMBCV(fake_fit, df, StartTime = Tstart, StopTime = Tstop, Cluster = clus_id, Event = DOES_NOT_EXIST), "Missing required columns" ) })