Some financial problems as minimizing the shortfall risk when hedging in incomplete markets lead to problems belonging to test theory. This paper considers
a generalization of the Neyman-Pearson lemma. With methods of convex duality
we deduce the structure of an optimal randomized test when testing a compound
hypothesis against a simple alternative. We give necessary and sufficient optimality
conditions for the problem.