We develop a model where a genetic test reveals whether an individual has a low or high probability of developing a disease. A costly prevention effort allows high-risk agents to decrease this probability. Agents are not obliged to take the test, but must disclose its results to insurers, and taking the test is associated to a discrimination risk. We study the individual decisions to take the test and to undertake the prevention effort as a function of the effort cost and of its efficiency. If effort is observable by insurers, agents undertake the test only if the effort cost is neither too large nor too low. If the effort cost is not observable by insurers, moral hazard increases the value of the test if the effort cost is low. We offer several policy recommendations, from the optimal breadth of the tests to policies to do away with the discrimination risk.