WebMvcRuntime { static WebMvcRuntime findWebMvcRuntime() { try { Class.forName("org.springframework.web.method.HandlerMethod"); return new WebMvc31(); } catch (ClassNotFoundException e) { } return new WebMvc25(); } WebMvcRuntime();   }
@Test public void findWebMvcRuntime_HandlerMethod_exists() throws Exception { assertThat(WebMvcRuntime.findWebMvcRuntime()) .isInstanceOf(WebMvc31.class); }
@Test public void findWebMvcRuntime_HandlerMethod_notFound() throws Exception { mockStatic(Class.class); when(Class.forName(HandlerMethod.class.getName())) .thenThrow(new ClassNotFoundException()); assertThat(WebMvcRuntime.findWebMvcRuntime()) .isInstanceOf(WebMvc25.class); }