First suppose is a classical harmonic function. At a local maximum of , its Hessian matrix is negative semidefinite, so . At a local minimum the Hessian inequality reverses and gives . Thus both test conditions hold.
Conversely, suppose only that is continuous and satisfies the two conditions. We prove the stronger conclusion that these conditions themselves imply and . Use the standard Dirichlet existence theorem on a ball: every continuous function on its boundary has a harmonic extension with exactly those boundary values. This follows, for example, from the Poisson integral. Apply it to on an arbitrary relatively compact ball, obtaining a harmonic replacement .
If is positive somewhere, choose small enough that is still positive there. It vanishes on the boundary and therefore has a positive maximum at an interior point. The upper test
has , contradicting the maximum test condition. Similarly, if is negative somewhere, yields an interior negative minimum of for small , but , contradicting the minimum condition. Hence throughout the ball.
If the quantifier requires rather than a local test, multiply the displayed smooth by a smooth cutoff supported within the ball and equal to one near the touching point, extending by zero outside. The resulting global test has the same germ and Laplacian there, so the argument remains valid. Since every point lies in such a ball, . This is the continuous viscosity harmonic functions are classical characterization.