int minutes;
if (settings.hasKey(SESSION_TIMEOUT_IN_MINUTES_PROPERTY)) {
minutes = settings.getInt(SESSION_TIMEOUT_IN_MINUTES_PROPERTY);
- checkArgument(minutes > 0, "Property %s must be strictly positive. Got %s.", SESSION_TIMEOUT_IN_MINUTES_PROPERTY, minutes);
+ checkArgument(minutes > 0, "Property %s must be strictly positive. Got %s", SESSION_TIMEOUT_IN_MINUTES_PROPERTY, minutes);
} else {
minutes = SESSION_TIMEOUT_DEFAULT_VALUE_IN_MINUTES;
}
- checkArgument(minutes <= MAX_SESSION_TIMEOUT_IN_MINUTES, "Property %s must not be greater than %s. Got %s.",
+ checkArgument(minutes <= MAX_SESSION_TIMEOUT_IN_MINUTES, "Property %s must not be greater than 3 months (%s minutes). Got %s minutes",
SESSION_TIMEOUT_IN_MINUTES_PROPERTY, MAX_SESSION_TIMEOUT_IN_MINUTES, minutes);
return minutes * 60;
}
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.mockito.ArgumentCaptor;
-import org.sonar.api.config.Settings;
import org.sonar.api.config.MapSettings;
+import org.sonar.api.config.Settings;
import org.sonar.api.utils.System2;
import org.sonar.db.DbClient;
import org.sonar.db.DbSession;
settings.setProperty("sonar.web.sessionTimeoutInMinutes", 0);
expectedException.expect(IllegalArgumentException.class);
- expectedException.expectMessage("Property sonar.web.sessionTimeoutInMinutes must be strictly positive. Got 0.");
+ expectedException.expectMessage("Property sonar.web.sessionTimeoutInMinutes must be strictly positive. Got 0");
new JwtHttpHandler(system2, dbClient, settings, jwtSerializer, jwtCsrfVerifier);
}
settings.setProperty("sonar.web.sessionTimeoutInMinutes", -10);
expectedException.expect(IllegalArgumentException.class);
- expectedException.expectMessage("Property sonar.web.sessionTimeoutInMinutes must be strictly positive. Got -10.");
+ expectedException.expectMessage("Property sonar.web.sessionTimeoutInMinutes must be strictly positive. Got -10");
new JwtHttpHandler(system2, dbClient, settings, jwtSerializer, jwtCsrfVerifier);
}
settings.setProperty("sonar.web.sessionTimeoutInMinutes", 4 * 30 * 24 * 60);
expectedException.expect(IllegalArgumentException.class);
- expectedException.expectMessage("Property sonar.web.sessionTimeoutInMinutes must not be greater than 129600. Got 172800.");
+ expectedException.expectMessage("Property sonar.web.sessionTimeoutInMinutes must not be greater than 3 months (129600 minutes). Got 172800 minutes");
new JwtHttpHandler(system2, dbClient, settings, jwtSerializer, jwtCsrfVerifier);
}