public class Extracted { static void foo(Test t) { switch (p) { case FRED: break; case GEORGE: break; } } }