target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test public void addPetTest() { Pet body = null; api.addPet(body); } | public void addPet(Pet body) throws RestClientException { addPetWithHttpInfo(body); } | PetApi { public void addPet(Pet body) throws RestClientException { addPetWithHttpInfo(body); } } | PetApi { public void addPet(Pet body) throws RestClientException { addPetWithHttpInfo(body); } PetApi(); @Autowired PetApi(ApiClient apiClient); } | PetApi { public void addPet(Pet body) throws RestClientException { addPetWithHttpInfo(body); } PetApi(); @Autowired PetApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void addPet(Pet body); ResponseEntity<Void> addPetWithHttpInfo(Pet body); void deletePet(Long petId, String ... | PetApi { public void addPet(Pet body) throws RestClientException { addPetWithHttpInfo(body); } PetApi(); @Autowired PetApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void addPet(Pet body); ResponseEntity<Void> addPetWithHttpInfo(Pet body); void deletePet(Long petId, String ... |
@Test public void deletePetTest() { Long petId = null; String apiKey = null; api.deletePet(petId, apiKey); } | public void deletePet(Long petId, String apiKey) throws RestClientException { deletePetWithHttpInfo(petId, apiKey); } | PetApi { public void deletePet(Long petId, String apiKey) throws RestClientException { deletePetWithHttpInfo(petId, apiKey); } } | PetApi { public void deletePet(Long petId, String apiKey) throws RestClientException { deletePetWithHttpInfo(petId, apiKey); } PetApi(); @Autowired PetApi(ApiClient apiClient); } | PetApi { public void deletePet(Long petId, String apiKey) throws RestClientException { deletePetWithHttpInfo(petId, apiKey); } PetApi(); @Autowired PetApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void addPet(Pet body); ResponseEntity<Void> addPetWithHttpInfo(Pet body); vo... | PetApi { public void deletePet(Long petId, String apiKey) throws RestClientException { deletePetWithHttpInfo(petId, apiKey); } PetApi(); @Autowired PetApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void addPet(Pet body); ResponseEntity<Void> addPetWithHttpInfo(Pet body); vo... |
@Test public void findPetsByStatusTest() { List<String> status = null; List<Pet> response = api.findPetsByStatus(status); } | public List<Pet> findPetsByStatus(List<String> status) throws RestClientException { return findPetsByStatusWithHttpInfo(status).getBody(); } | PetApi { public List<Pet> findPetsByStatus(List<String> status) throws RestClientException { return findPetsByStatusWithHttpInfo(status).getBody(); } } | PetApi { public List<Pet> findPetsByStatus(List<String> status) throws RestClientException { return findPetsByStatusWithHttpInfo(status).getBody(); } PetApi(); @Autowired PetApi(ApiClient apiClient); } | PetApi { public List<Pet> findPetsByStatus(List<String> status) throws RestClientException { return findPetsByStatusWithHttpInfo(status).getBody(); } PetApi(); @Autowired PetApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void addPet(Pet body); ResponseEntity<Void> addPetWit... | PetApi { public List<Pet> findPetsByStatus(List<String> status) throws RestClientException { return findPetsByStatusWithHttpInfo(status).getBody(); } PetApi(); @Autowired PetApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void addPet(Pet body); ResponseEntity<Void> addPetWit... |
@Test public void findPetsByTagsTest() { List<String> tags = null; List<Pet> response = api.findPetsByTags(tags); } | @Deprecated public List<Pet> findPetsByTags(List<String> tags) throws RestClientException { return findPetsByTagsWithHttpInfo(tags).getBody(); } | PetApi { @Deprecated public List<Pet> findPetsByTags(List<String> tags) throws RestClientException { return findPetsByTagsWithHttpInfo(tags).getBody(); } } | PetApi { @Deprecated public List<Pet> findPetsByTags(List<String> tags) throws RestClientException { return findPetsByTagsWithHttpInfo(tags).getBody(); } PetApi(); @Autowired PetApi(ApiClient apiClient); } | PetApi { @Deprecated public List<Pet> findPetsByTags(List<String> tags) throws RestClientException { return findPetsByTagsWithHttpInfo(tags).getBody(); } PetApi(); @Autowired PetApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void addPet(Pet body); ResponseEntity<Void> addPe... | PetApi { @Deprecated public List<Pet> findPetsByTags(List<String> tags) throws RestClientException { return findPetsByTagsWithHttpInfo(tags).getBody(); } PetApi(); @Autowired PetApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void addPet(Pet body); ResponseEntity<Void> addPe... |
@Test public void getPetByIdTest() { Long petId = null; Pet response = api.getPetById(petId); } | public Pet getPetById(Long petId) throws RestClientException { return getPetByIdWithHttpInfo(petId).getBody(); } | PetApi { public Pet getPetById(Long petId) throws RestClientException { return getPetByIdWithHttpInfo(petId).getBody(); } } | PetApi { public Pet getPetById(Long petId) throws RestClientException { return getPetByIdWithHttpInfo(petId).getBody(); } PetApi(); @Autowired PetApi(ApiClient apiClient); } | PetApi { public Pet getPetById(Long petId) throws RestClientException { return getPetByIdWithHttpInfo(petId).getBody(); } PetApi(); @Autowired PetApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void addPet(Pet body); ResponseEntity<Void> addPetWithHttpInfo(Pet body); void de... | PetApi { public Pet getPetById(Long petId) throws RestClientException { return getPetByIdWithHttpInfo(petId).getBody(); } PetApi(); @Autowired PetApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void addPet(Pet body); ResponseEntity<Void> addPetWithHttpInfo(Pet body); void de... |
@Test public void updatePetTest() { Pet body = null; api.updatePet(body); } | public void updatePet(Pet body) throws RestClientException { updatePetWithHttpInfo(body); } | PetApi { public void updatePet(Pet body) throws RestClientException { updatePetWithHttpInfo(body); } } | PetApi { public void updatePet(Pet body) throws RestClientException { updatePetWithHttpInfo(body); } PetApi(); @Autowired PetApi(ApiClient apiClient); } | PetApi { public void updatePet(Pet body) throws RestClientException { updatePetWithHttpInfo(body); } PetApi(); @Autowired PetApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void addPet(Pet body); ResponseEntity<Void> addPetWithHttpInfo(Pet body); void deletePet(Long petId, S... | PetApi { public void updatePet(Pet body) throws RestClientException { updatePetWithHttpInfo(body); } PetApi(); @Autowired PetApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void addPet(Pet body); ResponseEntity<Void> addPetWithHttpInfo(Pet body); void deletePet(Long petId, S... |
@Test public void whenSortStream_thenGetSortedStream() { List<Employee> employees = empList.stream() .sorted((e1, e2) -> e1.getName().compareTo(e2.getName())) .collect(Collectors.toList()); assertEquals(employees.get(0).getName(), "Bill Gates"); assertEquals(employees.get(1).getName(), "Jeff Bezos"); assertEquals(emplo... | public String getName() { return name; } | Employee { public String getName() { return name; } } | Employee { public String getName() { return name; } Employee(Integer id, String name, Double salary); } | Employee { public String getName() { return name; } Employee(Integer id, String name, Double salary); Integer getId(); void setId(Integer id); String getName(); void setName(String name); Double getSalary(); void setSalary(Double salary); void salaryIncrement(Double percentage); String toString(); } | Employee { public String getName() { return name; } Employee(Integer id, String name, Double salary); Integer getId(); void setId(Integer id); String getName(); void setName(String name); Double getSalary(); void setSalary(Double salary); void salaryIncrement(Double percentage); String toString(); } |
@Test public void updatePetWithFormTest() { Long petId = null; String name = null; String status = null; api.updatePetWithForm(petId, name, status); } | public void updatePetWithForm(Long petId, String name, String status) throws RestClientException { updatePetWithFormWithHttpInfo(petId, name, status); } | PetApi { public void updatePetWithForm(Long petId, String name, String status) throws RestClientException { updatePetWithFormWithHttpInfo(petId, name, status); } } | PetApi { public void updatePetWithForm(Long petId, String name, String status) throws RestClientException { updatePetWithFormWithHttpInfo(petId, name, status); } PetApi(); @Autowired PetApi(ApiClient apiClient); } | PetApi { public void updatePetWithForm(Long petId, String name, String status) throws RestClientException { updatePetWithFormWithHttpInfo(petId, name, status); } PetApi(); @Autowired PetApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void addPet(Pet body); ResponseEntity<Voi... | PetApi { public void updatePetWithForm(Long petId, String name, String status) throws RestClientException { updatePetWithFormWithHttpInfo(petId, name, status); } PetApi(); @Autowired PetApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void addPet(Pet body); ResponseEntity<Voi... |
@Test public void uploadFileTest() { Long petId = null; String additionalMetadata = null; File file = null; ModelApiResponse response = api.uploadFile(petId, additionalMetadata, file); } | public ModelApiResponse uploadFile(Long petId, String additionalMetadata, File file) throws RestClientException { return uploadFileWithHttpInfo(petId, additionalMetadata, file).getBody(); } | PetApi { public ModelApiResponse uploadFile(Long petId, String additionalMetadata, File file) throws RestClientException { return uploadFileWithHttpInfo(petId, additionalMetadata, file).getBody(); } } | PetApi { public ModelApiResponse uploadFile(Long petId, String additionalMetadata, File file) throws RestClientException { return uploadFileWithHttpInfo(petId, additionalMetadata, file).getBody(); } PetApi(); @Autowired PetApi(ApiClient apiClient); } | PetApi { public ModelApiResponse uploadFile(Long petId, String additionalMetadata, File file) throws RestClientException { return uploadFileWithHttpInfo(petId, additionalMetadata, file).getBody(); } PetApi(); @Autowired PetApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void... | PetApi { public ModelApiResponse uploadFile(Long petId, String additionalMetadata, File file) throws RestClientException { return uploadFileWithHttpInfo(petId, additionalMetadata, file).getBody(); } PetApi(); @Autowired PetApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void... |
@Test public void testFormatter() { String dateRegex1 = "^((19|20)\\d\\d)-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01]) ([2][0-3]|[0-1][0-9]|[1-9]):[0-5][0-9]:([0-5][0-9]|[6][0])$"; String dateString = Formatter.getFormattedDate(); assertTrue(Pattern .matches(dateRegex1, dateString)); } | public static String getFormattedDate() { DateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss"); Date date = new Date(); return dateFormat.format(date); } | Formatter { public static String getFormattedDate() { DateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss"); Date date = new Date(); return dateFormat.format(date); } } | Formatter { public static String getFormattedDate() { DateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss"); Date date = new Date(); return dateFormat.format(date); } } | Formatter { public static String getFormattedDate() { DateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss"); Date date = new Date(); return dateFormat.format(date); } static String getFormattedDate(); } | Formatter { public static String getFormattedDate() { DateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss"); Date date = new Date(); return dateFormat.format(date); } static String getFormattedDate(); } |
@Test public void testStartUpProdServletContext() throws ServletException { env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_PRODUCTION); webConfigurer.onStartup(servletContext); assertThat(servletContext.getAttribute(InstrumentedFilter.REGISTRY_ATTRIBUTE)).isEqualTo(metricRegistry); assertThat(servletContext.get... | @Override public void onStartup(ServletContext servletContext) throws ServletException { if (env.getActiveProfiles().length != 0) { log.info("Web application configuration, using profiles: {}", (Object[]) env.getActiveProfiles()); } EnumSet<DispatcherType> disps = EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWA... | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Override public void onStartup(ServletContext servletContext) throws ServletException { if (env.getActiveProfiles().length != 0) { log.info("Web application configuration, using profiles: {}", (Object[]) env.getActivePro... | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Override public void onStartup(ServletContext servletContext) throws ServletException { if (env.getActiveProfiles().length != 0) { log.info("Web application configuration, using profiles: {}", (Object[]) env.getActivePro... | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Override public void onStartup(ServletContext servletContext) throws ServletException { if (env.getActiveProfiles().length != 0) { log.info("Web application configuration, using profiles: {}", (Object[]) env.getActivePro... | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Override public void onStartup(ServletContext servletContext) throws ServletException { if (env.getActiveProfiles().length != 0) { log.info("Web application configuration, using profiles: {}", (Object[]) env.getActivePro... |
@Test public void testStartUpDevServletContext() throws ServletException { env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT); webConfigurer.onStartup(servletContext); assertThat(servletContext.getAttribute(InstrumentedFilter.REGISTRY_ATTRIBUTE)).isEqualTo(metricRegistry); assertThat(servletContext.get... | @Override public void onStartup(ServletContext servletContext) throws ServletException { if (env.getActiveProfiles().length != 0) { log.info("Web application configuration, using profiles: {}", (Object[]) env.getActiveProfiles()); } EnumSet<DispatcherType> disps = EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWA... | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Override public void onStartup(ServletContext servletContext) throws ServletException { if (env.getActiveProfiles().length != 0) { log.info("Web application configuration, using profiles: {}", (Object[]) env.getActivePro... | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Override public void onStartup(ServletContext servletContext) throws ServletException { if (env.getActiveProfiles().length != 0) { log.info("Web application configuration, using profiles: {}", (Object[]) env.getActivePro... | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Override public void onStartup(ServletContext servletContext) throws ServletException { if (env.getActiveProfiles().length != 0) { log.info("Web application configuration, using profiles: {}", (Object[]) env.getActivePro... | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Override public void onStartup(ServletContext servletContext) throws ServletException { if (env.getActiveProfiles().length != 0) { log.info("Web application configuration, using profiles: {}", (Object[]) env.getActivePro... |
@Test public void testCustomizeServletContainer() { env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_PRODUCTION); UndertowServletWebServerFactory container = new UndertowServletWebServerFactory(); webConfigurer.customize(container); assertThat(container.getMimeMappings().get("abs")).isEqualTo("audio/x-mpeg"); ass... | @Override public void customize(WebServerFactory server) { setMimeMappings(server); if (jHipsterProperties.getHttp().getVersion().equals(JHipsterProperties.Http.Version.V_2_0) && server instanceof UndertowServletWebServerFactory) { ((UndertowServletWebServerFactory) server) .addBuilderCustomizers(builder -> builder.set... | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Override public void customize(WebServerFactory server) { setMimeMappings(server); if (jHipsterProperties.getHttp().getVersion().equals(JHipsterProperties.Http.Version.V_2_0) && server instanceof UndertowServletWebServer... | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Override public void customize(WebServerFactory server) { setMimeMappings(server); if (jHipsterProperties.getHttp().getVersion().equals(JHipsterProperties.Http.Version.V_2_0) && server instanceof UndertowServletWebServer... | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Override public void customize(WebServerFactory server) { setMimeMappings(server); if (jHipsterProperties.getHttp().getVersion().equals(JHipsterProperties.Http.Version.V_2_0) && server instanceof UndertowServletWebServer... | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Override public void customize(WebServerFactory server) { setMimeMappings(server); if (jHipsterProperties.getHttp().getVersion().equals(JHipsterProperties.Http.Version.V_2_0) && server instanceof UndertowServletWebServer... |
@Test public void testUndertowHttp2Enabled() { props.getHttp().setVersion(JHipsterProperties.Http.Version.V_2_0); UndertowServletWebServerFactory container = new UndertowServletWebServerFactory(); webConfigurer.customize(container); Builder builder = Undertow.builder(); container.getBuilderCustomizers().forEach(c -> c.... | @Override public void customize(WebServerFactory server) { setMimeMappings(server); if (jHipsterProperties.getHttp().getVersion().equals(JHipsterProperties.Http.Version.V_2_0) && server instanceof UndertowServletWebServerFactory) { ((UndertowServletWebServerFactory) server) .addBuilderCustomizers(builder -> builder.set... | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Override public void customize(WebServerFactory server) { setMimeMappings(server); if (jHipsterProperties.getHttp().getVersion().equals(JHipsterProperties.Http.Version.V_2_0) && server instanceof UndertowServletWebServer... | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Override public void customize(WebServerFactory server) { setMimeMappings(server); if (jHipsterProperties.getHttp().getVersion().equals(JHipsterProperties.Http.Version.V_2_0) && server instanceof UndertowServletWebServer... | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Override public void customize(WebServerFactory server) { setMimeMappings(server); if (jHipsterProperties.getHttp().getVersion().equals(JHipsterProperties.Http.Version.V_2_0) && server instanceof UndertowServletWebServer... | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Override public void customize(WebServerFactory server) { setMimeMappings(server); if (jHipsterProperties.getHttp().getVersion().equals(JHipsterProperties.Http.Version.V_2_0) && server instanceof UndertowServletWebServer... |
@Test public void testCorsFilterOnApiPath() throws Exception { props.getCors().setAllowedOrigins(Collections.singletonList("*")); props.getCors().setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE")); props.getCors().setAllowedHeaders(Collections.singletonList("*")); props.getCors().setMaxAge(1800L); props.g... | @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !config.getAllowedOrigins().isEmpty()) { log.debug("Registering CORS filter"); source.registerCorsConf... | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !co... | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !co... | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !co... | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !co... |
@Test public void testCorsFilterOnOtherPath() throws Exception { props.getCors().setAllowedOrigins(Collections.singletonList("*")); props.getCors().setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE")); props.getCors().setAllowedHeaders(Collections.singletonList("*")); props.getCors().setMaxAge(1800L); props... | @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !config.getAllowedOrigins().isEmpty()) { log.debug("Registering CORS filter"); source.registerCorsConf... | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !co... | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !co... | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !co... | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !co... |
@Test public void testCorsFilterDeactivated() throws Exception { props.getCors().setAllowedOrigins(null); MockMvc mockMvc = MockMvcBuilders.standaloneSetup(new WebConfigurerTestController()) .addFilters(webConfigurer.corsFilter()) .build(); mockMvc.perform( get("/api/test-cors") .header(HttpHeaders.ORIGIN, "other.domai... | @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !config.getAllowedOrigins().isEmpty()) { log.debug("Registering CORS filter"); source.registerCorsConf... | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !co... | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !co... | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !co... | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !co... |
@Test public void whenFindMin_thenGetMinElementFromStream() { Employee firstEmp = empList.stream() .min((e1, e2) -> e1.getId() - e2.getId()) .orElseThrow(NoSuchElementException::new); assertEquals(firstEmp.getId(), new Integer(1)); } | public Integer getId() { return id; } | Employee { public Integer getId() { return id; } } | Employee { public Integer getId() { return id; } Employee(Integer id, String name, Double salary); } | Employee { public Integer getId() { return id; } Employee(Integer id, String name, Double salary); Integer getId(); void setId(Integer id); String getName(); void setName(String name); Double getSalary(); void setSalary(Double salary); void salaryIncrement(Double percentage); String toString(); } | Employee { public Integer getId() { return id; } Employee(Integer id, String name, Double salary); Integer getId(); void setId(Integer id); String getName(); void setName(String name); Double getSalary(); void setSalary(Double salary); void salaryIncrement(Double percentage); String toString(); } |
@Test public void testCorsFilterDeactivated2() throws Exception { props.getCors().setAllowedOrigins(new ArrayList<>()); MockMvc mockMvc = MockMvcBuilders.standaloneSetup(new WebConfigurerTestController()) .addFilters(webConfigurer.corsFilter()) .build(); mockMvc.perform( get("/api/test-cors") .header(HttpHeaders.ORIGIN... | @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !config.getAllowedOrigins().isEmpty()) { log.debug("Registering CORS filter"); source.registerCorsConf... | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !co... | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !co... | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !co... | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !co... |
@Test public void testAuthenticationCookies() { MockHttpServletRequest request = new MockHttpServletRequest(); request.setServerName("www.test.com"); request.addHeader("Authorization", CLIENT_AUTHORIZATION); Map<String, String> params = new HashMap<>(); params.put("username", "user"); params.put("password", "user"); pa... | public ResponseEntity<OAuth2AccessToken> authenticate(HttpServletRequest request, HttpServletResponse response, Map<String, String> params) { try { String username = params.get("username"); String password = params.get("password"); boolean rememberMe = Boolean.valueOf(params.get("rememberMe")); OAuth2AccessToken access... | OAuth2AuthenticationService { public ResponseEntity<OAuth2AccessToken> authenticate(HttpServletRequest request, HttpServletResponse response, Map<String, String> params) { try { String username = params.get("username"); String password = params.get("password"); boolean rememberMe = Boolean.valueOf(params.get("rememberM... | OAuth2AuthenticationService { public ResponseEntity<OAuth2AccessToken> authenticate(HttpServletRequest request, HttpServletResponse response, Map<String, String> params) { try { String username = params.get("username"); String password = params.get("password"); boolean rememberMe = Boolean.valueOf(params.get("rememberM... | OAuth2AuthenticationService { public ResponseEntity<OAuth2AccessToken> authenticate(HttpServletRequest request, HttpServletResponse response, Map<String, String> params) { try { String username = params.get("username"); String password = params.get("password"); boolean rememberMe = Boolean.valueOf(params.get("rememberM... | OAuth2AuthenticationService { public ResponseEntity<OAuth2AccessToken> authenticate(HttpServletRequest request, HttpServletResponse response, Map<String, String> params) { try { String username = params.get("username"); String password = params.get("password"); boolean rememberMe = Boolean.valueOf(params.get("rememberM... |
@Test public void whenFindMax_thenGetMaxElementFromStream() { Employee maxSalEmp = empList.stream() .max(Comparator.comparing(Employee::getSalary)) .orElseThrow(NoSuchElementException::new); assertEquals(maxSalEmp.getSalary(), new Double(300000.0)); } | public Double getSalary() { return salary; } | Employee { public Double getSalary() { return salary; } } | Employee { public Double getSalary() { return salary; } Employee(Integer id, String name, Double salary); } | Employee { public Double getSalary() { return salary; } Employee(Integer id, String name, Double salary); Integer getId(); void setId(Integer id); String getName(); void setName(String name); Double getSalary(); void setSalary(Double salary); void salaryIncrement(Double percentage); String toString(); } | Employee { public Double getSalary() { return salary; } Employee(Integer id, String name, Double salary); Integer getId(); void setId(Integer id); String getName(); void setName(String name); Double getSalary(); void setSalary(Double salary); void salaryIncrement(Double percentage); String toString(); } |
@Test public void testAuthenticationNoRememberMe() { MockHttpServletRequest request = new MockHttpServletRequest(); request.setServerName("www.test.com"); Map<String, String> params = new HashMap<>(); params.put("username", "user"); params.put("password", "user"); params.put("rememberMe", "false"); MockHttpServletRespo... | public ResponseEntity<OAuth2AccessToken> authenticate(HttpServletRequest request, HttpServletResponse response, Map<String, String> params) { try { String username = params.get("username"); String password = params.get("password"); boolean rememberMe = Boolean.valueOf(params.get("rememberMe")); OAuth2AccessToken access... | OAuth2AuthenticationService { public ResponseEntity<OAuth2AccessToken> authenticate(HttpServletRequest request, HttpServletResponse response, Map<String, String> params) { try { String username = params.get("username"); String password = params.get("password"); boolean rememberMe = Boolean.valueOf(params.get("rememberM... | OAuth2AuthenticationService { public ResponseEntity<OAuth2AccessToken> authenticate(HttpServletRequest request, HttpServletResponse response, Map<String, String> params) { try { String username = params.get("username"); String password = params.get("password"); boolean rememberMe = Boolean.valueOf(params.get("rememberM... | OAuth2AuthenticationService { public ResponseEntity<OAuth2AccessToken> authenticate(HttpServletRequest request, HttpServletResponse response, Map<String, String> params) { try { String username = params.get("username"); String password = params.get("password"); boolean rememberMe = Boolean.valueOf(params.get("rememberM... | OAuth2AuthenticationService { public ResponseEntity<OAuth2AccessToken> authenticate(HttpServletRequest request, HttpServletResponse response, Map<String, String> params) { try { String username = params.get("username"); String password = params.get("password"); boolean rememberMe = Boolean.valueOf(params.get("rememberM... |
@Test public void testInvalidPassword() { MockHttpServletRequest request = new MockHttpServletRequest(); request.setServerName("www.test.com"); Map<String, String> params = new HashMap<>(); params.put("username", "user"); params.put("password", "user2"); params.put("rememberMe", "false"); MockHttpServletResponse respon... | public ResponseEntity<OAuth2AccessToken> authenticate(HttpServletRequest request, HttpServletResponse response, Map<String, String> params) { try { String username = params.get("username"); String password = params.get("password"); boolean rememberMe = Boolean.valueOf(params.get("rememberMe")); OAuth2AccessToken access... | OAuth2AuthenticationService { public ResponseEntity<OAuth2AccessToken> authenticate(HttpServletRequest request, HttpServletResponse response, Map<String, String> params) { try { String username = params.get("username"); String password = params.get("password"); boolean rememberMe = Boolean.valueOf(params.get("rememberM... | OAuth2AuthenticationService { public ResponseEntity<OAuth2AccessToken> authenticate(HttpServletRequest request, HttpServletResponse response, Map<String, String> params) { try { String username = params.get("username"); String password = params.get("password"); boolean rememberMe = Boolean.valueOf(params.get("rememberM... | OAuth2AuthenticationService { public ResponseEntity<OAuth2AccessToken> authenticate(HttpServletRequest request, HttpServletResponse response, Map<String, String> params) { try { String username = params.get("username"); String password = params.get("password"); boolean rememberMe = Boolean.valueOf(params.get("rememberM... | OAuth2AuthenticationService { public ResponseEntity<OAuth2AccessToken> authenticate(HttpServletRequest request, HttpServletResponse response, Map<String, String> params) { try { String username = params.get("username"); String password = params.get("password"); boolean rememberMe = Boolean.valueOf(params.get("rememberM... |
@Test public void testLogout() { MockHttpServletRequest request = new MockHttpServletRequest(); Cookie accessTokenCookie = new Cookie(OAuth2CookieHelper.ACCESS_TOKEN_COOKIE, ACCESS_TOKEN_VALUE); Cookie refreshTokenCookie = new Cookie(OAuth2CookieHelper.REFRESH_TOKEN_COOKIE, REFRESH_TOKEN_VALUE); request.setCookies(acce... | public void logout(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) { cookieHelper.clearCookies(httpServletRequest, httpServletResponse); } | OAuth2AuthenticationService { public void logout(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) { cookieHelper.clearCookies(httpServletRequest, httpServletResponse); } } | OAuth2AuthenticationService { public void logout(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) { cookieHelper.clearCookies(httpServletRequest, httpServletResponse); } OAuth2AuthenticationService(OAuth2TokenEndpointClient authorizationClient, OAuth2CookieHelper cookieHelper); } | OAuth2AuthenticationService { public void logout(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) { cookieHelper.clearCookies(httpServletRequest, httpServletResponse); } OAuth2AuthenticationService(OAuth2TokenEndpointClient authorizationClient, OAuth2CookieHelper cookieHelper); ResponseEn... | OAuth2AuthenticationService { public void logout(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) { cookieHelper.clearCookies(httpServletRequest, httpServletResponse); } OAuth2AuthenticationService(OAuth2TokenEndpointClient authorizationClient, OAuth2CookieHelper cookieHelper); ResponseEn... |
@Test public void testStripTokens() { MockHttpServletRequest request = createMockHttpServletRequest(); HttpServletRequest newRequest = authenticationService.stripTokens(request); CookieCollection cookies = new CookieCollection(newRequest.getCookies()); Assert.assertFalse(cookies.contains(OAuth2CookieHelper.ACCESS_TOKEN... | public HttpServletRequest stripTokens(HttpServletRequest httpServletRequest) { Cookie[] cookies = cookieHelper.stripCookies(httpServletRequest.getCookies()); return new CookiesHttpServletRequestWrapper(httpServletRequest, cookies); } | OAuth2AuthenticationService { public HttpServletRequest stripTokens(HttpServletRequest httpServletRequest) { Cookie[] cookies = cookieHelper.stripCookies(httpServletRequest.getCookies()); return new CookiesHttpServletRequestWrapper(httpServletRequest, cookies); } } | OAuth2AuthenticationService { public HttpServletRequest stripTokens(HttpServletRequest httpServletRequest) { Cookie[] cookies = cookieHelper.stripCookies(httpServletRequest.getCookies()); return new CookiesHttpServletRequestWrapper(httpServletRequest, cookies); } OAuth2AuthenticationService(OAuth2TokenEndpointClient au... | OAuth2AuthenticationService { public HttpServletRequest stripTokens(HttpServletRequest httpServletRequest) { Cookie[] cookies = cookieHelper.stripCookies(httpServletRequest.getCookies()); return new CookiesHttpServletRequestWrapper(httpServletRequest, cookies); } OAuth2AuthenticationService(OAuth2TokenEndpointClient au... | OAuth2AuthenticationService { public HttpServletRequest stripTokens(HttpServletRequest httpServletRequest) { Cookie[] cookies = cookieHelper.stripCookies(httpServletRequest.getCookies()); return new CookiesHttpServletRequestWrapper(httpServletRequest, cookies); } OAuth2AuthenticationService(OAuth2TokenEndpointClient au... |
@Test public void size() throws Exception { CookieCollection cookies = new CookieCollection(); Assert.assertEquals(0, cookies.size()); cookies.add(cookie); Assert.assertEquals(1, cookies.size()); } | @Override public int size() { return cookieMap.size(); } | CookieCollection implements Collection<Cookie> { @Override public int size() { return cookieMap.size(); } } | CookieCollection implements Collection<Cookie> { @Override public int size() { return cookieMap.size(); } CookieCollection(); CookieCollection(Cookie... cookies); CookieCollection(Collection<? extends Cookie> cookies); } | CookieCollection implements Collection<Cookie> { @Override public int size() { return cookieMap.size(); } CookieCollection(); CookieCollection(Cookie... cookies); CookieCollection(Collection<? extends Cookie> cookies); @Override int size(); @Override boolean isEmpty(); @Override boolean contains(Object o); @Override ... | CookieCollection implements Collection<Cookie> { @Override public int size() { return cookieMap.size(); } CookieCollection(); CookieCollection(Cookie... cookies); CookieCollection(Collection<? extends Cookie> cookies); @Override int size(); @Override boolean isEmpty(); @Override boolean contains(Object o); @Override ... |
@Test public void isEmpty() throws Exception { CookieCollection cookies = new CookieCollection(); Assert.assertTrue(cookies.isEmpty()); cookies.add(cookie); Assert.assertFalse(cookies.isEmpty()); } | @Override public boolean isEmpty() { return cookieMap.isEmpty(); } | CookieCollection implements Collection<Cookie> { @Override public boolean isEmpty() { return cookieMap.isEmpty(); } } | CookieCollection implements Collection<Cookie> { @Override public boolean isEmpty() { return cookieMap.isEmpty(); } CookieCollection(); CookieCollection(Cookie... cookies); CookieCollection(Collection<? extends Cookie> cookies); } | CookieCollection implements Collection<Cookie> { @Override public boolean isEmpty() { return cookieMap.isEmpty(); } CookieCollection(); CookieCollection(Cookie... cookies); CookieCollection(Collection<? extends Cookie> cookies); @Override int size(); @Override boolean isEmpty(); @Override boolean contains(Object o); ... | CookieCollection implements Collection<Cookie> { @Override public boolean isEmpty() { return cookieMap.isEmpty(); } CookieCollection(); CookieCollection(Cookie... cookies); CookieCollection(Collection<? extends Cookie> cookies); @Override int size(); @Override boolean isEmpty(); @Override boolean contains(Object o); ... |
@Test public void contains() throws Exception { CookieCollection cookies = new CookieCollection(cookie); Assert.assertTrue(cookies.contains(cookie)); Assert.assertTrue(cookies.contains(COOKIE_NAME)); Assert.assertFalse(cookies.contains("yuck")); } | @Override public boolean contains(Object o) { if (o instanceof String) { return cookieMap.containsKey(o); } if (o instanceof Cookie) { return cookieMap.containsValue(o); } return false; } | CookieCollection implements Collection<Cookie> { @Override public boolean contains(Object o) { if (o instanceof String) { return cookieMap.containsKey(o); } if (o instanceof Cookie) { return cookieMap.containsValue(o); } return false; } } | CookieCollection implements Collection<Cookie> { @Override public boolean contains(Object o) { if (o instanceof String) { return cookieMap.containsKey(o); } if (o instanceof Cookie) { return cookieMap.containsValue(o); } return false; } CookieCollection(); CookieCollection(Cookie... cookies); CookieCollection(Collect... | CookieCollection implements Collection<Cookie> { @Override public boolean contains(Object o) { if (o instanceof String) { return cookieMap.containsKey(o); } if (o instanceof Cookie) { return cookieMap.containsValue(o); } return false; } CookieCollection(); CookieCollection(Cookie... cookies); CookieCollection(Collect... | CookieCollection implements Collection<Cookie> { @Override public boolean contains(Object o) { if (o instanceof String) { return cookieMap.containsKey(o); } if (o instanceof Cookie) { return cookieMap.containsValue(o); } return false; } CookieCollection(); CookieCollection(Cookie... cookies); CookieCollection(Collect... |
@Test public void iterator() throws Exception { CookieCollection cookies = new CookieCollection(cookie); Iterator<Cookie> it = cookies.iterator(); Assert.assertTrue(it.hasNext()); Assert.assertEquals(cookie, it.next()); Assert.assertFalse(it.hasNext()); } | @Override public Iterator<Cookie> iterator() { return cookieMap.values().iterator(); } | CookieCollection implements Collection<Cookie> { @Override public Iterator<Cookie> iterator() { return cookieMap.values().iterator(); } } | CookieCollection implements Collection<Cookie> { @Override public Iterator<Cookie> iterator() { return cookieMap.values().iterator(); } CookieCollection(); CookieCollection(Cookie... cookies); CookieCollection(Collection<? extends Cookie> cookies); } | CookieCollection implements Collection<Cookie> { @Override public Iterator<Cookie> iterator() { return cookieMap.values().iterator(); } CookieCollection(); CookieCollection(Cookie... cookies); CookieCollection(Collection<? extends Cookie> cookies); @Override int size(); @Override boolean isEmpty(); @Override boolean ... | CookieCollection implements Collection<Cookie> { @Override public Iterator<Cookie> iterator() { return cookieMap.values().iterator(); } CookieCollection(); CookieCollection(Cookie... cookies); CookieCollection(Collection<? extends Cookie> cookies); @Override int size(); @Override boolean isEmpty(); @Override boolean ... |
@Test public void toArray() throws Exception { CookieCollection cookies = new CookieCollection(cookie); Cookie[] array = cookies.toArray(); Assert.assertEquals(cookies.size(), array.length); Assert.assertEquals(cookie, array[0]); } | public Cookie[] toArray() { Cookie[] cookies = new Cookie[cookieMap.size()]; return toArray(cookies); } | CookieCollection implements Collection<Cookie> { public Cookie[] toArray() { Cookie[] cookies = new Cookie[cookieMap.size()]; return toArray(cookies); } } | CookieCollection implements Collection<Cookie> { public Cookie[] toArray() { Cookie[] cookies = new Cookie[cookieMap.size()]; return toArray(cookies); } CookieCollection(); CookieCollection(Cookie... cookies); CookieCollection(Collection<? extends Cookie> cookies); } | CookieCollection implements Collection<Cookie> { public Cookie[] toArray() { Cookie[] cookies = new Cookie[cookieMap.size()]; return toArray(cookies); } CookieCollection(); CookieCollection(Cookie... cookies); CookieCollection(Collection<? extends Cookie> cookies); @Override int size(); @Override boolean isEmpty(); @... | CookieCollection implements Collection<Cookie> { public Cookie[] toArray() { Cookie[] cookies = new Cookie[cookieMap.size()]; return toArray(cookies); } CookieCollection(); CookieCollection(Cookie... cookies); CookieCollection(Collection<? extends Cookie> cookies); @Override int size(); @Override boolean isEmpty(); @... |
@Test public void add() throws Exception { CookieCollection cookies = new CookieCollection(cookie); Cookie newCookie = new Cookie(BROWNIE_NAME, "mmh"); cookies.add(newCookie); Assert.assertEquals(2, cookies.size()); Assert.assertTrue(cookies.contains(newCookie)); Assert.assertTrue(cookies.contains(BROWNIE_NAME)); } | @Override public boolean add(Cookie cookie) { if (cookie == null) { return false; } cookieMap.put(cookie.getName(), cookie); return true; } | CookieCollection implements Collection<Cookie> { @Override public boolean add(Cookie cookie) { if (cookie == null) { return false; } cookieMap.put(cookie.getName(), cookie); return true; } } | CookieCollection implements Collection<Cookie> { @Override public boolean add(Cookie cookie) { if (cookie == null) { return false; } cookieMap.put(cookie.getName(), cookie); return true; } CookieCollection(); CookieCollection(Cookie... cookies); CookieCollection(Collection<? extends Cookie> cookies); } | CookieCollection implements Collection<Cookie> { @Override public boolean add(Cookie cookie) { if (cookie == null) { return false; } cookieMap.put(cookie.getName(), cookie); return true; } CookieCollection(); CookieCollection(Cookie... cookies); CookieCollection(Collection<? extends Cookie> cookies); @Override int si... | CookieCollection implements Collection<Cookie> { @Override public boolean add(Cookie cookie) { if (cookie == null) { return false; } cookieMap.put(cookie.getName(), cookie); return true; } CookieCollection(); CookieCollection(Cookie... cookies); CookieCollection(Collection<? extends Cookie> cookies); @Override int si... |
@Test public void whenCollectByJoining_thenGetJoinedString() { String empNames = empList.stream() .map(Employee::getName) .collect(Collectors.joining(", ")) .toString(); assertEquals(empNames, "Jeff Bezos, Bill Gates, Mark Zuckerberg"); } | public String toString() { return "Id: " + id + " Name:" + name + " Price:" + salary; } | Employee { public String toString() { return "Id: " + id + " Name:" + name + " Price:" + salary; } } | Employee { public String toString() { return "Id: " + id + " Name:" + name + " Price:" + salary; } Employee(Integer id, String name, Double salary); } | Employee { public String toString() { return "Id: " + id + " Name:" + name + " Price:" + salary; } Employee(Integer id, String name, Double salary); Integer getId(); void setId(Integer id); String getName(); void setName(String name); Double getSalary(); void setSalary(Double salary); void salaryIncrement(Double percen... | Employee { public String toString() { return "Id: " + id + " Name:" + name + " Price:" + salary; } Employee(Integer id, String name, Double salary); Integer getId(); void setId(Integer id); String getName(); void setName(String name); Double getSalary(); void setSalary(Double salary); void salaryIncrement(Double percen... |
@Test public void get() { CookieCollection cookies = new CookieCollection(cookie, brownieCookie, cupsCookie); Cookie c = cookies.get(COOKIE_NAME); Assert.assertNotNull(c); Assert.assertEquals(cookie, c); } | public Cookie get(String name) { return cookieMap.get(name); } | CookieCollection implements Collection<Cookie> { public Cookie get(String name) { return cookieMap.get(name); } } | CookieCollection implements Collection<Cookie> { public Cookie get(String name) { return cookieMap.get(name); } CookieCollection(); CookieCollection(Cookie... cookies); CookieCollection(Collection<? extends Cookie> cookies); } | CookieCollection implements Collection<Cookie> { public Cookie get(String name) { return cookieMap.get(name); } CookieCollection(); CookieCollection(Cookie... cookies); CookieCollection(Collection<? extends Cookie> cookies); @Override int size(); @Override boolean isEmpty(); @Override boolean contains(Object o); @Ove... | CookieCollection implements Collection<Cookie> { public Cookie get(String name) { return cookieMap.get(name); } CookieCollection(); CookieCollection(Cookie... cookies); CookieCollection(Collection<? extends Cookie> cookies); @Override int size(); @Override boolean isEmpty(); @Override boolean contains(Object o); @Ove... |
@Test public void remove() throws Exception { CookieCollection cookies = new CookieCollection(cookie, brownieCookie, cupsCookie); cookies.remove(cookie); Assert.assertEquals(2, cookies.size()); Assert.assertFalse(cookies.contains(cookie)); Assert.assertFalse(cookies.contains(COOKIE_NAME)); Assert.assertTrue(cookies.con... | @Override public boolean remove(Object o) { if (o instanceof String) { return cookieMap.remove((String)o) != null; } if (o instanceof Cookie) { Cookie c = (Cookie)o; return cookieMap.remove(c.getName()) != null; } return false; } | CookieCollection implements Collection<Cookie> { @Override public boolean remove(Object o) { if (o instanceof String) { return cookieMap.remove((String)o) != null; } if (o instanceof Cookie) { Cookie c = (Cookie)o; return cookieMap.remove(c.getName()) != null; } return false; } } | CookieCollection implements Collection<Cookie> { @Override public boolean remove(Object o) { if (o instanceof String) { return cookieMap.remove((String)o) != null; } if (o instanceof Cookie) { Cookie c = (Cookie)o; return cookieMap.remove(c.getName()) != null; } return false; } CookieCollection(); CookieCollection(Coo... | CookieCollection implements Collection<Cookie> { @Override public boolean remove(Object o) { if (o instanceof String) { return cookieMap.remove((String)o) != null; } if (o instanceof Cookie) { Cookie c = (Cookie)o; return cookieMap.remove(c.getName()) != null; } return false; } CookieCollection(); CookieCollection(Coo... | CookieCollection implements Collection<Cookie> { @Override public boolean remove(Object o) { if (o instanceof String) { return cookieMap.remove((String)o) != null; } if (o instanceof Cookie) { Cookie c = (Cookie)o; return cookieMap.remove(c.getName()) != null; } return false; } CookieCollection(); CookieCollection(Coo... |
@Test public void containsAll() throws Exception { List<Cookie> content = Arrays.asList(cookie, brownieCookie); CookieCollection cookies = new CookieCollection(content); Assert.assertTrue(cookies.containsAll(content)); Assert.assertTrue(cookies.containsAll(Collections.singletonList(cookie))); Assert.assertFalse(cookies... | @Override public boolean containsAll(Collection<?> collection) { for(Object o : collection) { if (!contains(o)) { return false; } } return true; } | CookieCollection implements Collection<Cookie> { @Override public boolean containsAll(Collection<?> collection) { for(Object o : collection) { if (!contains(o)) { return false; } } return true; } } | CookieCollection implements Collection<Cookie> { @Override public boolean containsAll(Collection<?> collection) { for(Object o : collection) { if (!contains(o)) { return false; } } return true; } CookieCollection(); CookieCollection(Cookie... cookies); CookieCollection(Collection<? extends Cookie> cookies); } | CookieCollection implements Collection<Cookie> { @Override public boolean containsAll(Collection<?> collection) { for(Object o : collection) { if (!contains(o)) { return false; } } return true; } CookieCollection(); CookieCollection(Cookie... cookies); CookieCollection(Collection<? extends Cookie> cookies); @Override... | CookieCollection implements Collection<Cookie> { @Override public boolean containsAll(Collection<?> collection) { for(Object o : collection) { if (!contains(o)) { return false; } } return true; } CookieCollection(); CookieCollection(Cookie... cookies); CookieCollection(Collection<? extends Cookie> cookies); @Override... |
@Test @SuppressWarnings("unchecked") public void addAll() throws Exception { CookieCollection cookies = new CookieCollection(); List<Cookie> content = Arrays.asList(cookie, brownieCookie, cupsCookie); boolean modified = cookies.addAll(content); Assert.assertTrue(modified); Assert.assertEquals(3, cookies.size()); Assert... | @Override public boolean addAll(Collection<? extends Cookie> collection) { boolean result = false; for(Cookie cookie : collection) { result|= add(cookie); } return result; } | CookieCollection implements Collection<Cookie> { @Override public boolean addAll(Collection<? extends Cookie> collection) { boolean result = false; for(Cookie cookie : collection) { result|= add(cookie); } return result; } } | CookieCollection implements Collection<Cookie> { @Override public boolean addAll(Collection<? extends Cookie> collection) { boolean result = false; for(Cookie cookie : collection) { result|= add(cookie); } return result; } CookieCollection(); CookieCollection(Cookie... cookies); CookieCollection(Collection<? extends ... | CookieCollection implements Collection<Cookie> { @Override public boolean addAll(Collection<? extends Cookie> collection) { boolean result = false; for(Cookie cookie : collection) { result|= add(cookie); } return result; } CookieCollection(); CookieCollection(Cookie... cookies); CookieCollection(Collection<? extends ... | CookieCollection implements Collection<Cookie> { @Override public boolean addAll(Collection<? extends Cookie> collection) { boolean result = false; for(Cookie cookie : collection) { result|= add(cookie); } return result; } CookieCollection(); CookieCollection(Cookie... cookies); CookieCollection(Collection<? extends ... |
@Test public void removeAll() throws Exception { CookieCollection cookies = new CookieCollection(cookie, brownieCookie, cupsCookie); boolean modified = cookies.removeAll(Arrays.asList(brownieCookie, cupsCookie)); Assert.assertTrue(modified); Assert.assertEquals(1, cookies.size()); Assert.assertFalse(cookies.contains(br... | @Override public boolean removeAll(Collection<?> collection) { boolean result = false; for(Object cookie : collection) { result|= remove(cookie); } return result; } | CookieCollection implements Collection<Cookie> { @Override public boolean removeAll(Collection<?> collection) { boolean result = false; for(Object cookie : collection) { result|= remove(cookie); } return result; } } | CookieCollection implements Collection<Cookie> { @Override public boolean removeAll(Collection<?> collection) { boolean result = false; for(Object cookie : collection) { result|= remove(cookie); } return result; } CookieCollection(); CookieCollection(Cookie... cookies); CookieCollection(Collection<? extends Cookie> c... | CookieCollection implements Collection<Cookie> { @Override public boolean removeAll(Collection<?> collection) { boolean result = false; for(Object cookie : collection) { result|= remove(cookie); } return result; } CookieCollection(); CookieCollection(Cookie... cookies); CookieCollection(Collection<? extends Cookie> c... | CookieCollection implements Collection<Cookie> { @Override public boolean removeAll(Collection<?> collection) { boolean result = false; for(Object cookie : collection) { result|= remove(cookie); } return result; } CookieCollection(); CookieCollection(Cookie... cookies); CookieCollection(Collection<? extends Cookie> c... |
@Test public void retainAll() throws Exception { CookieCollection cookies = new CookieCollection(cookie, brownieCookie, cupsCookie); List<Cookie> content = Arrays.asList(cookie, brownieCookie); boolean modified = cookies.retainAll(content); Assert.assertTrue(modified); Assert.assertEquals(2, cookies.size()); Assert.ass... | @Override public boolean retainAll(Collection<?> collection) { boolean result = false; Iterator<Map.Entry<String, Cookie>> it = cookieMap.entrySet().iterator(); while(it.hasNext()) { Map.Entry<String, Cookie> e = it.next(); if (!collection.contains(e.getKey()) && !collection.contains(e.getValue())) { it.remove(); resul... | CookieCollection implements Collection<Cookie> { @Override public boolean retainAll(Collection<?> collection) { boolean result = false; Iterator<Map.Entry<String, Cookie>> it = cookieMap.entrySet().iterator(); while(it.hasNext()) { Map.Entry<String, Cookie> e = it.next(); if (!collection.contains(e.getKey()) && !collec... | CookieCollection implements Collection<Cookie> { @Override public boolean retainAll(Collection<?> collection) { boolean result = false; Iterator<Map.Entry<String, Cookie>> it = cookieMap.entrySet().iterator(); while(it.hasNext()) { Map.Entry<String, Cookie> e = it.next(); if (!collection.contains(e.getKey()) && !collec... | CookieCollection implements Collection<Cookie> { @Override public boolean retainAll(Collection<?> collection) { boolean result = false; Iterator<Map.Entry<String, Cookie>> it = cookieMap.entrySet().iterator(); while(it.hasNext()) { Map.Entry<String, Cookie> e = it.next(); if (!collection.contains(e.getKey()) && !collec... | CookieCollection implements Collection<Cookie> { @Override public boolean retainAll(Collection<?> collection) { boolean result = false; Iterator<Map.Entry<String, Cookie>> it = cookieMap.entrySet().iterator(); while(it.hasNext()) { Map.Entry<String, Cookie> e = it.next(); if (!collection.contains(e.getKey()) && !collec... |
@Test public void clear() throws Exception { CookieCollection cookies = new CookieCollection(cookie); cookies.clear(); Assert.assertTrue(cookies.isEmpty()); } | @Override public void clear() { cookieMap.clear(); } | CookieCollection implements Collection<Cookie> { @Override public void clear() { cookieMap.clear(); } } | CookieCollection implements Collection<Cookie> { @Override public void clear() { cookieMap.clear(); } CookieCollection(); CookieCollection(Cookie... cookies); CookieCollection(Collection<? extends Cookie> cookies); } | CookieCollection implements Collection<Cookie> { @Override public void clear() { cookieMap.clear(); } CookieCollection(); CookieCollection(Cookie... cookies); CookieCollection(Collection<? extends Cookie> cookies); @Override int size(); @Override boolean isEmpty(); @Override boolean contains(Object o); @Override Iter... | CookieCollection implements Collection<Cookie> { @Override public void clear() { cookieMap.clear(); } CookieCollection(); CookieCollection(Cookie... cookies); CookieCollection(Collection<? extends Cookie> cookies); @Override int size(); @Override boolean isEmpty(); @Override boolean contains(Object o); @Override Iter... |
@Test public void testStartUpProdServletContext() throws ServletException { env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_PRODUCTION); webConfigurer.onStartup(servletContext); assertThat(servletContext.getAttribute(InstrumentedFilter.REGISTRY_ATTRIBUTE)).isEqualTo(metricRegistry); assertThat(servletContext.get... | @Override public void onStartup(ServletContext servletContext) throws ServletException { if (env.getActiveProfiles().length != 0) { log.info("Web application configuration, using profiles: {}", (Object[]) env.getActiveProfiles()); } EnumSet<DispatcherType> disps = EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWA... | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Override public void onStartup(ServletContext servletContext) throws ServletException { if (env.getActiveProfiles().length != 0) { log.info("Web application configuration, using profiles: {}", (Object[]) env.getActivePro... | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Override public void onStartup(ServletContext servletContext) throws ServletException { if (env.getActiveProfiles().length != 0) { log.info("Web application configuration, using profiles: {}", (Object[]) env.getActivePro... | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Override public void onStartup(ServletContext servletContext) throws ServletException { if (env.getActiveProfiles().length != 0) { log.info("Web application configuration, using profiles: {}", (Object[]) env.getActivePro... | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Override public void onStartup(ServletContext servletContext) throws ServletException { if (env.getActiveProfiles().length != 0) { log.info("Web application configuration, using profiles: {}", (Object[]) env.getActivePro... |
@Test public void testStartUpDevServletContext() throws ServletException { env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT); webConfigurer.onStartup(servletContext); assertThat(servletContext.getAttribute(InstrumentedFilter.REGISTRY_ATTRIBUTE)).isEqualTo(metricRegistry); assertThat(servletContext.get... | @Override public void onStartup(ServletContext servletContext) throws ServletException { if (env.getActiveProfiles().length != 0) { log.info("Web application configuration, using profiles: {}", (Object[]) env.getActiveProfiles()); } EnumSet<DispatcherType> disps = EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWA... | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Override public void onStartup(ServletContext servletContext) throws ServletException { if (env.getActiveProfiles().length != 0) { log.info("Web application configuration, using profiles: {}", (Object[]) env.getActivePro... | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Override public void onStartup(ServletContext servletContext) throws ServletException { if (env.getActiveProfiles().length != 0) { log.info("Web application configuration, using profiles: {}", (Object[]) env.getActivePro... | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Override public void onStartup(ServletContext servletContext) throws ServletException { if (env.getActiveProfiles().length != 0) { log.info("Web application configuration, using profiles: {}", (Object[]) env.getActivePro... | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Override public void onStartup(ServletContext servletContext) throws ServletException { if (env.getActiveProfiles().length != 0) { log.info("Web application configuration, using profiles: {}", (Object[]) env.getActivePro... |
@Test public void testCustomizeServletContainer() { env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_PRODUCTION); UndertowServletWebServerFactory container = new UndertowServletWebServerFactory(); webConfigurer.customize(container); assertThat(container.getMimeMappings().get("abs")).isEqualTo("audio/x-mpeg"); ass... | @Override public void customize(WebServerFactory server) { setMimeMappings(server); setLocationForStaticAssets(server); if (jHipsterProperties.getHttp().getVersion().equals(JHipsterProperties.Http.Version.V_2_0) && server instanceof UndertowServletWebServerFactory) { ((UndertowServletWebServerFactory) server) .addBuild... | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Override public void customize(WebServerFactory server) { setMimeMappings(server); setLocationForStaticAssets(server); if (jHipsterProperties.getHttp().getVersion().equals(JHipsterProperties.Http.Version.V_2_0) && server... | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Override public void customize(WebServerFactory server) { setMimeMappings(server); setLocationForStaticAssets(server); if (jHipsterProperties.getHttp().getVersion().equals(JHipsterProperties.Http.Version.V_2_0) && server... | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Override public void customize(WebServerFactory server) { setMimeMappings(server); setLocationForStaticAssets(server); if (jHipsterProperties.getHttp().getVersion().equals(JHipsterProperties.Http.Version.V_2_0) && server... | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Override public void customize(WebServerFactory server) { setMimeMappings(server); setLocationForStaticAssets(server); if (jHipsterProperties.getHttp().getVersion().equals(JHipsterProperties.Http.Version.V_2_0) && server... |
@Test public void whenStreamGroupingBy_thenGetMap() { Map<Character, List<Employee>> groupByAlphabet = empList.stream().collect( Collectors.groupingBy(e -> new Character(e.getName().charAt(0)))); assertEquals(groupByAlphabet.get('B').get(0).getName(), "Bill Gates"); assertEquals(groupByAlphabet.get('J').get(0).getName(... | public String getName() { return name; } | Employee { public String getName() { return name; } } | Employee { public String getName() { return name; } Employee(Integer id, String name, Double salary); } | Employee { public String getName() { return name; } Employee(Integer id, String name, Double salary); Integer getId(); void setId(Integer id); String getName(); void setName(String name); Double getSalary(); void setSalary(Double salary); void salaryIncrement(Double percentage); String toString(); } | Employee { public String getName() { return name; } Employee(Integer id, String name, Double salary); Integer getId(); void setId(Integer id); String getName(); void setName(String name); Double getSalary(); void setSalary(Double salary); void salaryIncrement(Double percentage); String toString(); } |
@Test public void zeroProfitWhenThereAreNoQualityViolations() { QualityAnalysis analysisWithoutViolations = QualityAnalysis.success(null, Collections.<QualityViolation>emptyList()); QualityInvestmentPlan qualityInvestmentPlan = investmentPlanService.computeInvestmentPlan(analysisWithoutViolations, "", 100); assertThat(... | public QualityInvestmentPlan computeInvestmentPlan(QualityAnalysis analysis, String basePackage, int investmentInMinutes) { Multimap<Double, QualityViolation> violationsByProfit = ArrayListMultimap.create(); for (QualityViolation violation : filterViolationsByArtefactNameStartingWith(basePackage, analysis.getViolations... | QualityInvestmentPlanService { public QualityInvestmentPlan computeInvestmentPlan(QualityAnalysis analysis, String basePackage, int investmentInMinutes) { Multimap<Double, QualityViolation> violationsByProfit = ArrayListMultimap.create(); for (QualityViolation violation : filterViolationsByArtefactNameStartingWith(base... | QualityInvestmentPlanService { public QualityInvestmentPlan computeInvestmentPlan(QualityAnalysis analysis, String basePackage, int investmentInMinutes) { Multimap<Double, QualityViolation> violationsByProfit = ArrayListMultimap.create(); for (QualityViolation violation : filterViolationsByArtefactNameStartingWith(base... | QualityInvestmentPlanService { public QualityInvestmentPlan computeInvestmentPlan(QualityAnalysis analysis, String basePackage, int investmentInMinutes) { Multimap<Double, QualityViolation> violationsByProfit = ArrayListMultimap.create(); for (QualityViolation violation : filterViolationsByArtefactNameStartingWith(base... | QualityInvestmentPlanService { public QualityInvestmentPlan computeInvestmentPlan(QualityAnalysis analysis, String basePackage, int investmentInMinutes) { Multimap<Double, QualityViolation> violationsByProfit = ArrayListMultimap.create(); for (QualityViolation violation : filterViolationsByArtefactNameStartingWith(base... |
@Test public void profitablePacakgesAndArtefactsShouldBeFilteredProperly() throws IOException { Artefact artefact1 = new Artefact("org.project.test.util.C", "DUMMY"); Artefact artefact2 = new Artefact("org.project.test.util.D", "DUMMY"); Artefact artefact3 = new Artefact("org.project.test.E", "DUMMY"); Artefact artefac... | public String generate(QualityAnalysis analysis) throws JsonProcessingException { Set<String> alreadyAddedArtefacts = Sets.newHashSet(); Map<String, PackageNode> nodeLookupTable = Maps.newHashMap(); RootNode rootNode = new RootNode(analysis.getProject().getName()); for (QualityViolation violation : analysis.getViolatio... | InvestmentOpportunitiesJsonGenerator { public String generate(QualityAnalysis analysis) throws JsonProcessingException { Set<String> alreadyAddedArtefacts = Sets.newHashSet(); Map<String, PackageNode> nodeLookupTable = Maps.newHashMap(); RootNode rootNode = new RootNode(analysis.getProject().getName()); for (QualityVio... | InvestmentOpportunitiesJsonGenerator { public String generate(QualityAnalysis analysis) throws JsonProcessingException { Set<String> alreadyAddedArtefacts = Sets.newHashSet(); Map<String, PackageNode> nodeLookupTable = Maps.newHashMap(); RootNode rootNode = new RootNode(analysis.getProject().getName()); for (QualityVio... | InvestmentOpportunitiesJsonGenerator { public String generate(QualityAnalysis analysis) throws JsonProcessingException { Set<String> alreadyAddedArtefacts = Sets.newHashSet(); Map<String, PackageNode> nodeLookupTable = Maps.newHashMap(); RootNode rootNode = new RootNode(analysis.getProject().getName()); for (QualityVio... | InvestmentOpportunitiesJsonGenerator { public String generate(QualityAnalysis analysis) throws JsonProcessingException { Set<String> alreadyAddedArtefacts = Sets.newHashSet(); Map<String, PackageNode> nodeLookupTable = Maps.newHashMap(); RootNode rootNode = new RootNode(analysis.getProject().getName()); for (QualityVio... |
@Test public void shouldSupportProjectType() { assertThat(validator.supports(Project.class)).isTrue(); } | @Override public boolean supports(Class<?> clazz) { return Project.class.equals(clazz); } | ProjectValidator implements Validator { @Override public boolean supports(Class<?> clazz) { return Project.class.equals(clazz); } } | ProjectValidator implements Validator { @Override public boolean supports(Class<?> clazz) { return Project.class.equals(clazz); } @Autowired ProjectValidator(ProjectRepository projectRepository,
QualityProfileRepository profileRepository,
SonarConnectionSettingsValidator sonarConn... | ProjectValidator implements Validator { @Override public boolean supports(Class<?> clazz) { return Project.class.equals(clazz); } @Autowired ProjectValidator(ProjectRepository projectRepository,
QualityProfileRepository profileRepository,
SonarConnectionSettingsValidator sonarConn... | ProjectValidator implements Validator { @Override public boolean supports(Class<?> clazz) { return Project.class.equals(clazz); } @Autowired ProjectValidator(ProjectRepository projectRepository,
QualityProfileRepository profileRepository,
SonarConnectionSettingsValidator sonarConn... |
@Test public void shouldNotSupportOtherTypeThanProject() { assertThat(validator.supports(Object.class)).isFalse(); } | @Override public boolean supports(Class<?> clazz) { return Project.class.equals(clazz); } | ProjectValidator implements Validator { @Override public boolean supports(Class<?> clazz) { return Project.class.equals(clazz); } } | ProjectValidator implements Validator { @Override public boolean supports(Class<?> clazz) { return Project.class.equals(clazz); } @Autowired ProjectValidator(ProjectRepository projectRepository,
QualityProfileRepository profileRepository,
SonarConnectionSettingsValidator sonarConn... | ProjectValidator implements Validator { @Override public boolean supports(Class<?> clazz) { return Project.class.equals(clazz); } @Autowired ProjectValidator(ProjectRepository projectRepository,
QualityProfileRepository profileRepository,
SonarConnectionSettingsValidator sonarConn... | ProjectValidator implements Validator { @Override public boolean supports(Class<?> clazz) { return Project.class.equals(clazz); } @Autowired ProjectValidator(ProjectRepository projectRepository,
QualityProfileRepository profileRepository,
SonarConnectionSettingsValidator sonarConn... |
@Test public void shouldSupportCodeChangeSettingsType() { assertThat(validator.supports(CodeChangeSettings.class)).isTrue(); } | @Override public boolean supports(Class<?> clazz) { return CodeChangeSettings.class.equals(clazz); } | CodeChangeSettingsValidator implements Validator { @Override public boolean supports(Class<?> clazz) { return CodeChangeSettings.class.equals(clazz); } } | CodeChangeSettingsValidator implements Validator { @Override public boolean supports(Class<?> clazz) { return CodeChangeSettings.class.equals(clazz); } } | CodeChangeSettingsValidator implements Validator { @Override public boolean supports(Class<?> clazz) { return CodeChangeSettings.class.equals(clazz); } @Override boolean supports(Class<?> clazz); @Override void validate(Object target, Errors errors); } | CodeChangeSettingsValidator implements Validator { @Override public boolean supports(Class<?> clazz) { return CodeChangeSettings.class.equals(clazz); } @Override boolean supports(Class<?> clazz); @Override void validate(Object target, Errors errors); } |
@Test public void shouldNotSupportOtherTypeThanCodeChangeSettings() { assertThat(validator.supports(Object.class)).isFalse(); } | @Override public boolean supports(Class<?> clazz) { return CodeChangeSettings.class.equals(clazz); } | CodeChangeSettingsValidator implements Validator { @Override public boolean supports(Class<?> clazz) { return CodeChangeSettings.class.equals(clazz); } } | CodeChangeSettingsValidator implements Validator { @Override public boolean supports(Class<?> clazz) { return CodeChangeSettings.class.equals(clazz); } } | CodeChangeSettingsValidator implements Validator { @Override public boolean supports(Class<?> clazz) { return CodeChangeSettings.class.equals(clazz); } @Override boolean supports(Class<?> clazz); @Override void validate(Object target, Errors errors); } | CodeChangeSettingsValidator implements Validator { @Override public boolean supports(Class<?> clazz) { return CodeChangeSettings.class.equals(clazz); } @Override boolean supports(Class<?> clazz); @Override void validate(Object target, Errors errors); } |
@Test public void shouldSupportProjectType() { assertThat(validator.supports(Project.class)).isTrue(); } | @Override public boolean supports(Class<?> clazz) { return Project.class.equals(clazz); } | ProjectConnectionsValidator implements Validator { @Override public boolean supports(Class<?> clazz) { return Project.class.equals(clazz); } } | ProjectConnectionsValidator implements Validator { @Override public boolean supports(Class<?> clazz) { return Project.class.equals(clazz); } @Autowired ProjectConnectionsValidator(ProjectValidator projectValidator,
SonarConnectionCheckerService sonarConnectionCheckerService,
... | ProjectConnectionsValidator implements Validator { @Override public boolean supports(Class<?> clazz) { return Project.class.equals(clazz); } @Autowired ProjectConnectionsValidator(ProjectValidator projectValidator,
SonarConnectionCheckerService sonarConnectionCheckerService,
... | ProjectConnectionsValidator implements Validator { @Override public boolean supports(Class<?> clazz) { return Project.class.equals(clazz); } @Autowired ProjectConnectionsValidator(ProjectValidator projectValidator,
SonarConnectionCheckerService sonarConnectionCheckerService,
... |
@Test public void shouldNotSupportOtherTypeThanProject() { assertThat(validator.supports(Object.class)).isFalse(); } | @Override public boolean supports(Class<?> clazz) { return Project.class.equals(clazz); } | ProjectConnectionsValidator implements Validator { @Override public boolean supports(Class<?> clazz) { return Project.class.equals(clazz); } } | ProjectConnectionsValidator implements Validator { @Override public boolean supports(Class<?> clazz) { return Project.class.equals(clazz); } @Autowired ProjectConnectionsValidator(ProjectValidator projectValidator,
SonarConnectionCheckerService sonarConnectionCheckerService,
... | ProjectConnectionsValidator implements Validator { @Override public boolean supports(Class<?> clazz) { return Project.class.equals(clazz); } @Autowired ProjectConnectionsValidator(ProjectValidator projectValidator,
SonarConnectionCheckerService sonarConnectionCheckerService,
... | ProjectConnectionsValidator implements Validator { @Override public boolean supports(Class<?> clazz) { return Project.class.equals(clazz); } @Autowired ProjectConnectionsValidator(ProjectValidator projectValidator,
SonarConnectionCheckerService sonarConnectionCheckerService,
... |
@Test public void shouldCallSuppliedProjectValidator() { when(sonarConnectionCheckerService.isReachable(any(SonarConnectionSettings.class))).thenReturn(true); mockAvailableScmSystem(); validateProject(project); verify(projectValidator).validate(any(), any(Errors.class)); } | @Override public void validate(Object target, Errors errors) { ValidationUtils.invokeValidator(projectValidator, target, errors); Project project = (Project) target; if (!sonarConnectionCheckerService.isReachable(project.getSonarConnectionSettings())) { errors.rejectValue("sonarConnectionSettings", "sonar.not.reachable... | ProjectConnectionsValidator implements Validator { @Override public void validate(Object target, Errors errors) { ValidationUtils.invokeValidator(projectValidator, target, errors); Project project = (Project) target; if (!sonarConnectionCheckerService.isReachable(project.getSonarConnectionSettings())) { errors.rejectVa... | ProjectConnectionsValidator implements Validator { @Override public void validate(Object target, Errors errors) { ValidationUtils.invokeValidator(projectValidator, target, errors); Project project = (Project) target; if (!sonarConnectionCheckerService.isReachable(project.getSonarConnectionSettings())) { errors.rejectVa... | ProjectConnectionsValidator implements Validator { @Override public void validate(Object target, Errors errors) { ValidationUtils.invokeValidator(projectValidator, target, errors); Project project = (Project) target; if (!sonarConnectionCheckerService.isReachable(project.getSonarConnectionSettings())) { errors.rejectVa... | ProjectConnectionsValidator implements Validator { @Override public void validate(Object target, Errors errors) { ValidationUtils.invokeValidator(projectValidator, target, errors); Project project = (Project) target; if (!sonarConnectionCheckerService.isReachable(project.getSonarConnectionSettings())) { errors.rejectVa... |
@Test public void shouldSupportScmConnectionSettingsType() { assertThat(validator.supports(ScmConnectionSettings.class)).isTrue(); } | @Override public boolean supports(Class<?> clazz) { return ScmConnectionSettings.class.equals(clazz); } | ScmConnectionSettingsValidator implements Validator { @Override public boolean supports(Class<?> clazz) { return ScmConnectionSettings.class.equals(clazz); } } | ScmConnectionSettingsValidator implements Validator { @Override public boolean supports(Class<?> clazz) { return ScmConnectionSettings.class.equals(clazz); } } | ScmConnectionSettingsValidator implements Validator { @Override public boolean supports(Class<?> clazz) { return ScmConnectionSettings.class.equals(clazz); } @Override boolean supports(Class<?> clazz); @Override void validate(Object target, Errors errors); } | ScmConnectionSettingsValidator implements Validator { @Override public boolean supports(Class<?> clazz) { return ScmConnectionSettings.class.equals(clazz); } @Override boolean supports(Class<?> clazz); @Override void validate(Object target, Errors errors); } |
@Test public void shouldNotSupportOtherTypeThanScmConnectionSettings() { assertThat(validator.supports(Object.class)).isFalse(); } | @Override public boolean supports(Class<?> clazz) { return ScmConnectionSettings.class.equals(clazz); } | ScmConnectionSettingsValidator implements Validator { @Override public boolean supports(Class<?> clazz) { return ScmConnectionSettings.class.equals(clazz); } } | ScmConnectionSettingsValidator implements Validator { @Override public boolean supports(Class<?> clazz) { return ScmConnectionSettings.class.equals(clazz); } } | ScmConnectionSettingsValidator implements Validator { @Override public boolean supports(Class<?> clazz) { return ScmConnectionSettings.class.equals(clazz); } @Override boolean supports(Class<?> clazz); @Override void validate(Object target, Errors errors); } | ScmConnectionSettingsValidator implements Validator { @Override public boolean supports(Class<?> clazz) { return ScmConnectionSettings.class.equals(clazz); } @Override boolean supports(Class<?> clazz); @Override void validate(Object target, Errors errors); } |
@Test public void shouldGenerateInvestmentPlanForOneArtefact() { QualityViolation violation1 = new QualityViolation(new Artefact("org.project.A", ""), createRequirementOnlyWithCriteria(new QualityCriteria("cc", "<", 5.0)), 50, 0, 0.0, "ncloc"); QualityViolation violation2 = new QualityViolation(new Artefact("org.projec... | public QualityInvestmentPlan computeInvestmentPlan(QualityAnalysis analysis, String basePackage, int investmentInMinutes) { Multimap<Double, QualityViolation> violationsByProfit = ArrayListMultimap.create(); for (QualityViolation violation : filterViolationsByArtefactNameStartingWith(basePackage, analysis.getViolations... | QualityInvestmentPlanService { public QualityInvestmentPlan computeInvestmentPlan(QualityAnalysis analysis, String basePackage, int investmentInMinutes) { Multimap<Double, QualityViolation> violationsByProfit = ArrayListMultimap.create(); for (QualityViolation violation : filterViolationsByArtefactNameStartingWith(base... | QualityInvestmentPlanService { public QualityInvestmentPlan computeInvestmentPlan(QualityAnalysis analysis, String basePackage, int investmentInMinutes) { Multimap<Double, QualityViolation> violationsByProfit = ArrayListMultimap.create(); for (QualityViolation violation : filterViolationsByArtefactNameStartingWith(base... | QualityInvestmentPlanService { public QualityInvestmentPlan computeInvestmentPlan(QualityAnalysis analysis, String basePackage, int investmentInMinutes) { Multimap<Double, QualityViolation> violationsByProfit = ArrayListMultimap.create(); for (QualityViolation violation : filterViolationsByArtefactNameStartingWith(base... | QualityInvestmentPlanService { public QualityInvestmentPlan computeInvestmentPlan(QualityAnalysis analysis, String basePackage, int investmentInMinutes) { Multimap<Double, QualityViolation> violationsByProfit = ArrayListMultimap.create(); for (QualityViolation violation : filterViolationsByArtefactNameStartingWith(base... |
@Test public void shouldGenerateInvestmentPlanForOneSubPackage() { QualityViolation violation1 = new QualityViolation(new Artefact("org.project.a.test.A", ""), createRequirementOnlyWithCriteria(new QualityCriteria("cc", "<", 5.0)), 50, 0, 0.0, "ncloc"); QualityViolation violation2 = new QualityViolation(new Artefact("o... | public QualityInvestmentPlan computeInvestmentPlan(QualityAnalysis analysis, String basePackage, int investmentInMinutes) { Multimap<Double, QualityViolation> violationsByProfit = ArrayListMultimap.create(); for (QualityViolation violation : filterViolationsByArtefactNameStartingWith(basePackage, analysis.getViolations... | QualityInvestmentPlanService { public QualityInvestmentPlan computeInvestmentPlan(QualityAnalysis analysis, String basePackage, int investmentInMinutes) { Multimap<Double, QualityViolation> violationsByProfit = ArrayListMultimap.create(); for (QualityViolation violation : filterViolationsByArtefactNameStartingWith(base... | QualityInvestmentPlanService { public QualityInvestmentPlan computeInvestmentPlan(QualityAnalysis analysis, String basePackage, int investmentInMinutes) { Multimap<Double, QualityViolation> violationsByProfit = ArrayListMultimap.create(); for (QualityViolation violation : filterViolationsByArtefactNameStartingWith(base... | QualityInvestmentPlanService { public QualityInvestmentPlan computeInvestmentPlan(QualityAnalysis analysis, String basePackage, int investmentInMinutes) { Multimap<Double, QualityViolation> violationsByProfit = ArrayListMultimap.create(); for (QualityViolation violation : filterViolationsByArtefactNameStartingWith(base... | QualityInvestmentPlanService { public QualityInvestmentPlan computeInvestmentPlan(QualityAnalysis analysis, String basePackage, int investmentInMinutes) { Multimap<Double, QualityViolation> violationsByProfit = ArrayListMultimap.create(); for (QualityViolation violation : filterViolationsByArtefactNameStartingWith(base... |
@Test public void emptyStringShouldBeParsedToZeroMinutes() throws InvestmentParsingException { assertThat(parser.parseMinutes("")).isEqualTo(0); } | public int parseMinutes(String formattedInvestmentAmount) throws InvestmentParsingException { if (formattedInvestmentAmount.isEmpty()) { return 0; } Pattern pattern = Pattern.compile("(\\d*h)?\\s?(\\d*m)?"); Matcher matcher = pattern.matcher(formattedInvestmentAmount); int minutes = 0; if (!matcher.find()) { throw new ... | InvestmentAmountParser { public int parseMinutes(String formattedInvestmentAmount) throws InvestmentParsingException { if (formattedInvestmentAmount.isEmpty()) { return 0; } Pattern pattern = Pattern.compile("(\\d*h)?\\s?(\\d*m)?"); Matcher matcher = pattern.matcher(formattedInvestmentAmount); int minutes = 0; if (!mat... | InvestmentAmountParser { public int parseMinutes(String formattedInvestmentAmount) throws InvestmentParsingException { if (formattedInvestmentAmount.isEmpty()) { return 0; } Pattern pattern = Pattern.compile("(\\d*h)?\\s?(\\d*m)?"); Matcher matcher = pattern.matcher(formattedInvestmentAmount); int minutes = 0; if (!mat... | InvestmentAmountParser { public int parseMinutes(String formattedInvestmentAmount) throws InvestmentParsingException { if (formattedInvestmentAmount.isEmpty()) { return 0; } Pattern pattern = Pattern.compile("(\\d*h)?\\s?(\\d*m)?"); Matcher matcher = pattern.matcher(formattedInvestmentAmount); int minutes = 0; if (!mat... | InvestmentAmountParser { public int parseMinutes(String formattedInvestmentAmount) throws InvestmentParsingException { if (formattedInvestmentAmount.isEmpty()) { return 0; } Pattern pattern = Pattern.compile("(\\d*h)?\\s?(\\d*m)?"); Matcher matcher = pattern.matcher(formattedInvestmentAmount); int minutes = 0; if (!mat... |
@Test public void shouldParseHoursProperly() throws InvestmentParsingException { assertThat(parser.parseMinutes("3h")).isEqualTo(180); } | public int parseMinutes(String formattedInvestmentAmount) throws InvestmentParsingException { if (formattedInvestmentAmount.isEmpty()) { return 0; } Pattern pattern = Pattern.compile("(\\d*h)?\\s?(\\d*m)?"); Matcher matcher = pattern.matcher(formattedInvestmentAmount); int minutes = 0; if (!matcher.find()) { throw new ... | InvestmentAmountParser { public int parseMinutes(String formattedInvestmentAmount) throws InvestmentParsingException { if (formattedInvestmentAmount.isEmpty()) { return 0; } Pattern pattern = Pattern.compile("(\\d*h)?\\s?(\\d*m)?"); Matcher matcher = pattern.matcher(formattedInvestmentAmount); int minutes = 0; if (!mat... | InvestmentAmountParser { public int parseMinutes(String formattedInvestmentAmount) throws InvestmentParsingException { if (formattedInvestmentAmount.isEmpty()) { return 0; } Pattern pattern = Pattern.compile("(\\d*h)?\\s?(\\d*m)?"); Matcher matcher = pattern.matcher(formattedInvestmentAmount); int minutes = 0; if (!mat... | InvestmentAmountParser { public int parseMinutes(String formattedInvestmentAmount) throws InvestmentParsingException { if (formattedInvestmentAmount.isEmpty()) { return 0; } Pattern pattern = Pattern.compile("(\\d*h)?\\s?(\\d*m)?"); Matcher matcher = pattern.matcher(formattedInvestmentAmount); int minutes = 0; if (!mat... | InvestmentAmountParser { public int parseMinutes(String formattedInvestmentAmount) throws InvestmentParsingException { if (formattedInvestmentAmount.isEmpty()) { return 0; } Pattern pattern = Pattern.compile("(\\d*h)?\\s?(\\d*m)?"); Matcher matcher = pattern.matcher(formattedInvestmentAmount); int minutes = 0; if (!mat... |
@Test public void shouldParseMinutesProperly() throws InvestmentParsingException { assertThat(parser.parseMinutes("21m")).isEqualTo(21); } | public int parseMinutes(String formattedInvestmentAmount) throws InvestmentParsingException { if (formattedInvestmentAmount.isEmpty()) { return 0; } Pattern pattern = Pattern.compile("(\\d*h)?\\s?(\\d*m)?"); Matcher matcher = pattern.matcher(formattedInvestmentAmount); int minutes = 0; if (!matcher.find()) { throw new ... | InvestmentAmountParser { public int parseMinutes(String formattedInvestmentAmount) throws InvestmentParsingException { if (formattedInvestmentAmount.isEmpty()) { return 0; } Pattern pattern = Pattern.compile("(\\d*h)?\\s?(\\d*m)?"); Matcher matcher = pattern.matcher(formattedInvestmentAmount); int minutes = 0; if (!mat... | InvestmentAmountParser { public int parseMinutes(String formattedInvestmentAmount) throws InvestmentParsingException { if (formattedInvestmentAmount.isEmpty()) { return 0; } Pattern pattern = Pattern.compile("(\\d*h)?\\s?(\\d*m)?"); Matcher matcher = pattern.matcher(formattedInvestmentAmount); int minutes = 0; if (!mat... | InvestmentAmountParser { public int parseMinutes(String formattedInvestmentAmount) throws InvestmentParsingException { if (formattedInvestmentAmount.isEmpty()) { return 0; } Pattern pattern = Pattern.compile("(\\d*h)?\\s?(\\d*m)?"); Matcher matcher = pattern.matcher(formattedInvestmentAmount); int minutes = 0; if (!mat... | InvestmentAmountParser { public int parseMinutes(String formattedInvestmentAmount) throws InvestmentParsingException { if (formattedInvestmentAmount.isEmpty()) { return 0; } Pattern pattern = Pattern.compile("(\\d*h)?\\s?(\\d*m)?"); Matcher matcher = pattern.matcher(formattedInvestmentAmount); int minutes = 0; if (!mat... |
@Test public void shouldParseHoursAndMinutesProperly() throws InvestmentParsingException { assertThat(parser.parseMinutes("3h 70m")).isEqualTo(250); } | public int parseMinutes(String formattedInvestmentAmount) throws InvestmentParsingException { if (formattedInvestmentAmount.isEmpty()) { return 0; } Pattern pattern = Pattern.compile("(\\d*h)?\\s?(\\d*m)?"); Matcher matcher = pattern.matcher(formattedInvestmentAmount); int minutes = 0; if (!matcher.find()) { throw new ... | InvestmentAmountParser { public int parseMinutes(String formattedInvestmentAmount) throws InvestmentParsingException { if (formattedInvestmentAmount.isEmpty()) { return 0; } Pattern pattern = Pattern.compile("(\\d*h)?\\s?(\\d*m)?"); Matcher matcher = pattern.matcher(formattedInvestmentAmount); int minutes = 0; if (!mat... | InvestmentAmountParser { public int parseMinutes(String formattedInvestmentAmount) throws InvestmentParsingException { if (formattedInvestmentAmount.isEmpty()) { return 0; } Pattern pattern = Pattern.compile("(\\d*h)?\\s?(\\d*m)?"); Matcher matcher = pattern.matcher(formattedInvestmentAmount); int minutes = 0; if (!mat... | InvestmentAmountParser { public int parseMinutes(String formattedInvestmentAmount) throws InvestmentParsingException { if (formattedInvestmentAmount.isEmpty()) { return 0; } Pattern pattern = Pattern.compile("(\\d*h)?\\s?(\\d*m)?"); Matcher matcher = pattern.matcher(formattedInvestmentAmount); int minutes = 0; if (!mat... | InvestmentAmountParser { public int parseMinutes(String formattedInvestmentAmount) throws InvestmentParsingException { if (formattedInvestmentAmount.isEmpty()) { return 0; } Pattern pattern = Pattern.compile("(\\d*h)?\\s?(\\d*m)?"); Matcher matcher = pattern.matcher(formattedInvestmentAmount); int minutes = 0; if (!mat... |
@Test(expected = InvestmentParsingException.class) public void shouldThrowExceptionWhenGivenStringIsNotParsable() throws InvestmentParsingException { parser.parseMinutes("abc0m"); } | public int parseMinutes(String formattedInvestmentAmount) throws InvestmentParsingException { if (formattedInvestmentAmount.isEmpty()) { return 0; } Pattern pattern = Pattern.compile("(\\d*h)?\\s?(\\d*m)?"); Matcher matcher = pattern.matcher(formattedInvestmentAmount); int minutes = 0; if (!matcher.find()) { throw new ... | InvestmentAmountParser { public int parseMinutes(String formattedInvestmentAmount) throws InvestmentParsingException { if (formattedInvestmentAmount.isEmpty()) { return 0; } Pattern pattern = Pattern.compile("(\\d*h)?\\s?(\\d*m)?"); Matcher matcher = pattern.matcher(formattedInvestmentAmount); int minutes = 0; if (!mat... | InvestmentAmountParser { public int parseMinutes(String formattedInvestmentAmount) throws InvestmentParsingException { if (formattedInvestmentAmount.isEmpty()) { return 0; } Pattern pattern = Pattern.compile("(\\d*h)?\\s?(\\d*m)?"); Matcher matcher = pattern.matcher(formattedInvestmentAmount); int minutes = 0; if (!mat... | InvestmentAmountParser { public int parseMinutes(String formattedInvestmentAmount) throws InvestmentParsingException { if (formattedInvestmentAmount.isEmpty()) { return 0; } Pattern pattern = Pattern.compile("(\\d*h)?\\s?(\\d*m)?"); Matcher matcher = pattern.matcher(formattedInvestmentAmount); int minutes = 0; if (!mat... | InvestmentAmountParser { public int parseMinutes(String formattedInvestmentAmount) throws InvestmentParsingException { if (formattedInvestmentAmount.isEmpty()) { return 0; } Pattern pattern = Pattern.compile("(\\d*h)?\\s?(\\d*m)?"); Matcher matcher = pattern.matcher(formattedInvestmentAmount); int minutes = 0; if (!mat... |
@Test public void profitForAutomaticFixableViolation() { when(requirement.isAutomaticallyFixable()).thenReturn(true); assertThat(calculator.calculateProfit(violation)).isEqualTo(2.0); } | public double calculateProfit(QualityViolation violation) { double nonRemediationCosts = violation.getNonRemediationCosts() * (violation.getArtefact().hasManualEstimate() ? violation.getArtefact().getManualEstimate() / 100.0 : violation.getArtefact().getChangeProbability()); return violation.getRequirement().isAutomati... | ProfitCalculator { public double calculateProfit(QualityViolation violation) { double nonRemediationCosts = violation.getNonRemediationCosts() * (violation.getArtefact().hasManualEstimate() ? violation.getArtefact().getManualEstimate() / 100.0 : violation.getArtefact().getChangeProbability()); return violation.getRequi... | ProfitCalculator { public double calculateProfit(QualityViolation violation) { double nonRemediationCosts = violation.getNonRemediationCosts() * (violation.getArtefact().hasManualEstimate() ? violation.getArtefact().getManualEstimate() / 100.0 : violation.getArtefact().getChangeProbability()); return violation.getRequi... | ProfitCalculator { public double calculateProfit(QualityViolation violation) { double nonRemediationCosts = violation.getNonRemediationCosts() * (violation.getArtefact().hasManualEstimate() ? violation.getArtefact().getManualEstimate() / 100.0 : violation.getArtefact().getChangeProbability()); return violation.getRequi... | ProfitCalculator { public double calculateProfit(QualityViolation violation) { double nonRemediationCosts = violation.getNonRemediationCosts() * (violation.getArtefact().hasManualEstimate() ? violation.getArtefact().getManualEstimate() / 100.0 : violation.getArtefact().getChangeProbability()); return violation.getRequi... |
@Test public void profitForNotAutomaticFixableViolation() { when(requirement.isAutomaticallyFixable()).thenReturn(false); when(artefact.getSecureChangeProbability()).thenReturn(1.1); assertThat(calculator.calculateProfit(violation)).isEqualTo(1.0); } | public double calculateProfit(QualityViolation violation) { double nonRemediationCosts = violation.getNonRemediationCosts() * (violation.getArtefact().hasManualEstimate() ? violation.getArtefact().getManualEstimate() / 100.0 : violation.getArtefact().getChangeProbability()); return violation.getRequirement().isAutomati... | ProfitCalculator { public double calculateProfit(QualityViolation violation) { double nonRemediationCosts = violation.getNonRemediationCosts() * (violation.getArtefact().hasManualEstimate() ? violation.getArtefact().getManualEstimate() / 100.0 : violation.getArtefact().getChangeProbability()); return violation.getRequi... | ProfitCalculator { public double calculateProfit(QualityViolation violation) { double nonRemediationCosts = violation.getNonRemediationCosts() * (violation.getArtefact().hasManualEstimate() ? violation.getArtefact().getManualEstimate() / 100.0 : violation.getArtefact().getChangeProbability()); return violation.getRequi... | ProfitCalculator { public double calculateProfit(QualityViolation violation) { double nonRemediationCosts = violation.getNonRemediationCosts() * (violation.getArtefact().hasManualEstimate() ? violation.getArtefact().getManualEstimate() / 100.0 : violation.getArtefact().getChangeProbability()); return violation.getRequi... | ProfitCalculator { public double calculateProfit(QualityViolation violation) { double nonRemediationCosts = violation.getNonRemediationCosts() * (violation.getArtefact().hasManualEstimate() ? violation.getArtefact().getManualEstimate() / 100.0 : violation.getArtefact().getChangeProbability()); return violation.getRequi... |
@Test public void profitForViolationWhereArtefactHasManualEstimate() { when(requirement.isAutomaticallyFixable()).thenReturn(true); when(artefact.getManualEstimate()).thenReturn(80); when(artefact.hasManualEstimate()).thenReturn(true); assertThat(calculator.calculateProfit(violation)).isEqualTo(6.0); } | public double calculateProfit(QualityViolation violation) { double nonRemediationCosts = violation.getNonRemediationCosts() * (violation.getArtefact().hasManualEstimate() ? violation.getArtefact().getManualEstimate() / 100.0 : violation.getArtefact().getChangeProbability()); return violation.getRequirement().isAutomati... | ProfitCalculator { public double calculateProfit(QualityViolation violation) { double nonRemediationCosts = violation.getNonRemediationCosts() * (violation.getArtefact().hasManualEstimate() ? violation.getArtefact().getManualEstimate() / 100.0 : violation.getArtefact().getChangeProbability()); return violation.getRequi... | ProfitCalculator { public double calculateProfit(QualityViolation violation) { double nonRemediationCosts = violation.getNonRemediationCosts() * (violation.getArtefact().hasManualEstimate() ? violation.getArtefact().getManualEstimate() / 100.0 : violation.getArtefact().getChangeProbability()); return violation.getRequi... | ProfitCalculator { public double calculateProfit(QualityViolation violation) { double nonRemediationCosts = violation.getNonRemediationCosts() * (violation.getArtefact().hasManualEstimate() ? violation.getArtefact().getManualEstimate() / 100.0 : violation.getArtefact().getChangeProbability()); return violation.getRequi... | ProfitCalculator { public double calculateProfit(QualityViolation violation) { double nonRemediationCosts = violation.getNonRemediationCosts() * (violation.getArtefact().hasManualEstimate() ? violation.getArtefact().getManualEstimate() / 100.0 : violation.getArtefact().getChangeProbability()); return violation.getRequi... |
@Test public void calculatesOverallProfitForAllQualityViolations() { QualityInvestmentPlan qualityInvestmentPlan = investmentPlanService.computeInvestmentPlan(analysis, "", 80); assertThat(qualityInvestmentPlan.getProfitInMinutes()) .as("The overall profit should be calculated based on all quality violations.") .isEqua... | public QualityInvestmentPlan computeInvestmentPlan(QualityAnalysis analysis, String basePackage, int investmentInMinutes) { Multimap<Double, QualityViolation> violationsByProfit = ArrayListMultimap.create(); for (QualityViolation violation : filterViolationsByArtefactNameStartingWith(basePackage, analysis.getViolations... | QualityInvestmentPlanService { public QualityInvestmentPlan computeInvestmentPlan(QualityAnalysis analysis, String basePackage, int investmentInMinutes) { Multimap<Double, QualityViolation> violationsByProfit = ArrayListMultimap.create(); for (QualityViolation violation : filterViolationsByArtefactNameStartingWith(base... | QualityInvestmentPlanService { public QualityInvestmentPlan computeInvestmentPlan(QualityAnalysis analysis, String basePackage, int investmentInMinutes) { Multimap<Double, QualityViolation> violationsByProfit = ArrayListMultimap.create(); for (QualityViolation violation : filterViolationsByArtefactNameStartingWith(base... | QualityInvestmentPlanService { public QualityInvestmentPlan computeInvestmentPlan(QualityAnalysis analysis, String basePackage, int investmentInMinutes) { Multimap<Double, QualityViolation> violationsByProfit = ArrayListMultimap.create(); for (QualityViolation violation : filterViolationsByArtefactNameStartingWith(base... | QualityInvestmentPlanService { public QualityInvestmentPlan computeInvestmentPlan(QualityAnalysis analysis, String basePackage, int investmentInMinutes) { Multimap<Double, QualityViolation> violationsByProfit = ArrayListMultimap.create(); for (QualityViolation violation : filterViolationsByArtefactNameStartingWith(base... |
@Test public void shouldDivideProfitOfViolationByWeightingMetricValue() { ProfitCalculator profitCalculator = mock(ProfitCalculator.class); when(profitCalculator.calculateProfit(any(QualityViolation.class))).thenReturn(20.0); QualityViolation violation = mock(QualityViolation.class); when(violation.getWeightingMetricVa... | public double calculateWeightedProfit(QualityViolation violation) { return profitCalculator.calculateProfit(violation) / violation.getWeightingMetricValue(); } | WeightedProfitCalculator { public double calculateWeightedProfit(QualityViolation violation) { return profitCalculator.calculateProfit(violation) / violation.getWeightingMetricValue(); } } | WeightedProfitCalculator { public double calculateWeightedProfit(QualityViolation violation) { return profitCalculator.calculateProfit(violation) / violation.getWeightingMetricValue(); } @Autowired WeightedProfitCalculator(ProfitCalculator profitCalculator); } | WeightedProfitCalculator { public double calculateWeightedProfit(QualityViolation violation) { return profitCalculator.calculateProfit(violation) / violation.getWeightingMetricValue(); } @Autowired WeightedProfitCalculator(ProfitCalculator profitCalculator); double calculateWeightedProfit(QualityViolation violation); ... | WeightedProfitCalculator { public double calculateWeightedProfit(QualityViolation violation) { return profitCalculator.calculateProfit(violation) / violation.getWeightingMetricValue(); } @Autowired WeightedProfitCalculator(ProfitCalculator profitCalculator); double calculateWeightedProfit(QualityViolation violation); ... |
@Test public void codeChurnForOneLastCommit() throws CodeChurnCalculationException, ScmConnectionEncodingException { fakeCodeChurnCalculator.addCodeChurnWithoutDay("A", new CodeChurn(Arrays.asList(0.8))); CodeChangeProbabilityCalculator codeChangeProbabilityCalculator = new CommitBasedCodeChangeProbabilityCalculator(co... | @Override public double calculateCodeChangeProbability(ScmConnectionSettings connectionSettings, String file) throws CodeChurnCalculationException, ScmConnectionEncodingException { log.info("Calculate code change probability for file {}", file); final CodeChurnCalculator codeChurnCalculator = codeChurnCalculatorFactory... | CommitBasedCodeChangeProbabilityCalculator implements CodeChangeProbabilityCalculator { @Override public double calculateCodeChangeProbability(ScmConnectionSettings connectionSettings, String file) throws CodeChurnCalculationException, ScmConnectionEncodingException { log.info("Calculate code change probability for fil... | CommitBasedCodeChangeProbabilityCalculator implements CodeChangeProbabilityCalculator { @Override public double calculateCodeChangeProbability(ScmConnectionSettings connectionSettings, String file) throws CodeChurnCalculationException, ScmConnectionEncodingException { log.info("Calculate code change probability for fil... | CommitBasedCodeChangeProbabilityCalculator implements CodeChangeProbabilityCalculator { @Override public double calculateCodeChangeProbability(ScmConnectionSettings connectionSettings, String file) throws CodeChurnCalculationException, ScmConnectionEncodingException { log.info("Calculate code change probability for fil... | CommitBasedCodeChangeProbabilityCalculator implements CodeChangeProbabilityCalculator { @Override public double calculateCodeChangeProbability(ScmConnectionSettings connectionSettings, String file) throws CodeChurnCalculationException, ScmConnectionEncodingException { log.info("Calculate code change probability for fil... |
@Test public void codeChurnForManyLastCommits() throws CodeChurnCalculationException, ScmConnectionEncodingException { fakeCodeChurnCalculator.addCodeChurnWithoutDay("A", new CodeChurn(Arrays.asList(0.8))); fakeCodeChurnCalculator.addCodeChurnWithoutDay("A", new CodeChurn(Arrays.asList(1.0))); fakeCodeChurnCalculator.a... | @Override public double calculateCodeChangeProbability(ScmConnectionSettings connectionSettings, String file) throws CodeChurnCalculationException, ScmConnectionEncodingException { log.info("Calculate code change probability for file {}", file); final CodeChurnCalculator codeChurnCalculator = codeChurnCalculatorFactory... | CommitBasedCodeChangeProbabilityCalculator implements CodeChangeProbabilityCalculator { @Override public double calculateCodeChangeProbability(ScmConnectionSettings connectionSettings, String file) throws CodeChurnCalculationException, ScmConnectionEncodingException { log.info("Calculate code change probability for fil... | CommitBasedCodeChangeProbabilityCalculator implements CodeChangeProbabilityCalculator { @Override public double calculateCodeChangeProbability(ScmConnectionSettings connectionSettings, String file) throws CodeChurnCalculationException, ScmConnectionEncodingException { log.info("Calculate code change probability for fil... | CommitBasedCodeChangeProbabilityCalculator implements CodeChangeProbabilityCalculator { @Override public double calculateCodeChangeProbability(ScmConnectionSettings connectionSettings, String file) throws CodeChurnCalculationException, ScmConnectionEncodingException { log.info("Calculate code change probability for fil... | CommitBasedCodeChangeProbabilityCalculator implements CodeChangeProbabilityCalculator { @Override public double calculateCodeChangeProbability(ScmConnectionSettings connectionSettings, String file) throws CodeChurnCalculationException, ScmConnectionEncodingException { log.info("Calculate code change probability for fil... |
@Test public void maxPossibleProbabilityShouldBeOne() throws CodeChurnCalculationException, ScmConnectionEncodingException { fakeCodeChurnCalculator.addCodeChurnWithoutDay("A", new CodeChurn(Arrays.asList(10.0))); CodeChangeProbabilityCalculator codeChangeProbabilityCalculator = new CommitBasedCodeChangeProbabilityCalc... | @Override public double calculateCodeChangeProbability(ScmConnectionSettings connectionSettings, String file) throws CodeChurnCalculationException, ScmConnectionEncodingException { log.info("Calculate code change probability for file {}", file); final CodeChurnCalculator codeChurnCalculator = codeChurnCalculatorFactory... | CommitBasedCodeChangeProbabilityCalculator implements CodeChangeProbabilityCalculator { @Override public double calculateCodeChangeProbability(ScmConnectionSettings connectionSettings, String file) throws CodeChurnCalculationException, ScmConnectionEncodingException { log.info("Calculate code change probability for fil... | CommitBasedCodeChangeProbabilityCalculator implements CodeChangeProbabilityCalculator { @Override public double calculateCodeChangeProbability(ScmConnectionSettings connectionSettings, String file) throws CodeChurnCalculationException, ScmConnectionEncodingException { log.info("Calculate code change probability for fil... | CommitBasedCodeChangeProbabilityCalculator implements CodeChangeProbabilityCalculator { @Override public double calculateCodeChangeProbability(ScmConnectionSettings connectionSettings, String file) throws CodeChurnCalculationException, ScmConnectionEncodingException { log.info("Calculate code change probability for fil... | CommitBasedCodeChangeProbabilityCalculator implements CodeChangeProbabilityCalculator { @Override public double calculateCodeChangeProbability(ScmConnectionSettings connectionSettings, String file) throws CodeChurnCalculationException, ScmConnectionEncodingException { log.info("Calculate code change probability for fil... |
@Test(expected = UnsupportedScmSystem.class) public void shouldFailForNotSupportedSvmTypesWithException() { ScmConnectionSettings connectionSettings = mock(ScmConnectionSettings.class); when(connectionSettings.getType()).thenReturn(Integer.MAX_VALUE); codeChurnCalculatorFactory.create(connectionSettings); } | public CodeChurnCalculator create(ScmConnectionSettings connectionSettings) { if (connectionSettings.getType() == SupportedScmSystem.SVN.getType()) { return svnCodeChurnCalculator; } throw new UnsupportedScmSystem(); } | CodeChurnCalculatorFactory { public CodeChurnCalculator create(ScmConnectionSettings connectionSettings) { if (connectionSettings.getType() == SupportedScmSystem.SVN.getType()) { return svnCodeChurnCalculator; } throw new UnsupportedScmSystem(); } } | CodeChurnCalculatorFactory { public CodeChurnCalculator create(ScmConnectionSettings connectionSettings) { if (connectionSettings.getType() == SupportedScmSystem.SVN.getType()) { return svnCodeChurnCalculator; } throw new UnsupportedScmSystem(); } @Autowired CodeChurnCalculatorFactory(SvnCodeChurnCalculatorService svn... | CodeChurnCalculatorFactory { public CodeChurnCalculator create(ScmConnectionSettings connectionSettings) { if (connectionSettings.getType() == SupportedScmSystem.SVN.getType()) { return svnCodeChurnCalculator; } throw new UnsupportedScmSystem(); } @Autowired CodeChurnCalculatorFactory(SvnCodeChurnCalculatorService svn... | CodeChurnCalculatorFactory { public CodeChurnCalculator create(ScmConnectionSettings connectionSettings) { if (connectionSettings.getType() == SupportedScmSystem.SVN.getType()) { return svnCodeChurnCalculator; } throw new UnsupportedScmSystem(); } @Autowired CodeChurnCalculatorFactory(SvnCodeChurnCalculatorService svn... |
@Test public void createSvnCodeChurnCalculatorForSvnType() { ScmConnectionSettings connectionSettings = mock(ScmConnectionSettings.class); when(connectionSettings.getType()).thenReturn(SupportedScmSystem.SVN.getType()); assertThat(codeChurnCalculatorFactory.create(connectionSettings)).isInstanceOf(SvnCodeChurnCalculato... | public CodeChurnCalculator create(ScmConnectionSettings connectionSettings) { if (connectionSettings.getType() == SupportedScmSystem.SVN.getType()) { return svnCodeChurnCalculator; } throw new UnsupportedScmSystem(); } | CodeChurnCalculatorFactory { public CodeChurnCalculator create(ScmConnectionSettings connectionSettings) { if (connectionSettings.getType() == SupportedScmSystem.SVN.getType()) { return svnCodeChurnCalculator; } throw new UnsupportedScmSystem(); } } | CodeChurnCalculatorFactory { public CodeChurnCalculator create(ScmConnectionSettings connectionSettings) { if (connectionSettings.getType() == SupportedScmSystem.SVN.getType()) { return svnCodeChurnCalculator; } throw new UnsupportedScmSystem(); } @Autowired CodeChurnCalculatorFactory(SvnCodeChurnCalculatorService svn... | CodeChurnCalculatorFactory { public CodeChurnCalculator create(ScmConnectionSettings connectionSettings) { if (connectionSettings.getType() == SupportedScmSystem.SVN.getType()) { return svnCodeChurnCalculator; } throw new UnsupportedScmSystem(); } @Autowired CodeChurnCalculatorFactory(SvnCodeChurnCalculatorService svn... | CodeChurnCalculatorFactory { public CodeChurnCalculator create(ScmConnectionSettings connectionSettings) { if (connectionSettings.getType() == SupportedScmSystem.SVN.getType()) { return svnCodeChurnCalculator; } throw new UnsupportedScmSystem(); } @Autowired CodeChurnCalculatorFactory(SvnCodeChurnCalculatorService svn... |
@Test public void notAvailableWhenScmSettingsAreNull() { assertThat(availabilityCheckerService.isAvailable(null)).isFalse(); } | @Override public boolean isAvailable(ScmConnectionSettings connectionSettings) { if (connectionSettings == null || Strings.isNullOrEmpty(connectionSettings.getUrl())) { return false; } try { SvnRepositoryFactory.create(connectionSettings).testConnection(); log.info("The given svn server is reachable with connection set... | SvnServerAvailabilityCheckerService implements ScmAvailabilityCheckerService { @Override public boolean isAvailable(ScmConnectionSettings connectionSettings) { if (connectionSettings == null || Strings.isNullOrEmpty(connectionSettings.getUrl())) { return false; } try { SvnRepositoryFactory.create(connectionSettings).te... | SvnServerAvailabilityCheckerService implements ScmAvailabilityCheckerService { @Override public boolean isAvailable(ScmConnectionSettings connectionSettings) { if (connectionSettings == null || Strings.isNullOrEmpty(connectionSettings.getUrl())) { return false; } try { SvnRepositoryFactory.create(connectionSettings).te... | SvnServerAvailabilityCheckerService implements ScmAvailabilityCheckerService { @Override public boolean isAvailable(ScmConnectionSettings connectionSettings) { if (connectionSettings == null || Strings.isNullOrEmpty(connectionSettings.getUrl())) { return false; } try { SvnRepositoryFactory.create(connectionSettings).te... | SvnServerAvailabilityCheckerService implements ScmAvailabilityCheckerService { @Override public boolean isAvailable(ScmConnectionSettings connectionSettings) { if (connectionSettings == null || Strings.isNullOrEmpty(connectionSettings.getUrl())) { return false; } try { SvnRepositoryFactory.create(connectionSettings).te... |
@Test public void notAvailableWhenUrlOfScmSettingsIsNull() { assertThat(availabilityCheckerService.isAvailable(new ScmConnectionSettings(null))).isFalse(); } | @Override public boolean isAvailable(ScmConnectionSettings connectionSettings) { if (connectionSettings == null || Strings.isNullOrEmpty(connectionSettings.getUrl())) { return false; } try { SvnRepositoryFactory.create(connectionSettings).testConnection(); log.info("The given svn server is reachable with connection set... | SvnServerAvailabilityCheckerService implements ScmAvailabilityCheckerService { @Override public boolean isAvailable(ScmConnectionSettings connectionSettings) { if (connectionSettings == null || Strings.isNullOrEmpty(connectionSettings.getUrl())) { return false; } try { SvnRepositoryFactory.create(connectionSettings).te... | SvnServerAvailabilityCheckerService implements ScmAvailabilityCheckerService { @Override public boolean isAvailable(ScmConnectionSettings connectionSettings) { if (connectionSettings == null || Strings.isNullOrEmpty(connectionSettings.getUrl())) { return false; } try { SvnRepositoryFactory.create(connectionSettings).te... | SvnServerAvailabilityCheckerService implements ScmAvailabilityCheckerService { @Override public boolean isAvailable(ScmConnectionSettings connectionSettings) { if (connectionSettings == null || Strings.isNullOrEmpty(connectionSettings.getUrl())) { return false; } try { SvnRepositoryFactory.create(connectionSettings).te... | SvnServerAvailabilityCheckerService implements ScmAvailabilityCheckerService { @Override public boolean isAvailable(ScmConnectionSettings connectionSettings) { if (connectionSettings == null || Strings.isNullOrEmpty(connectionSettings.getUrl())) { return false; } try { SvnRepositoryFactory.create(connectionSettings).te... |
@Test public void notAvailableWhenUrlOfScmSettingsIsEmpty() { assertThat(availabilityCheckerService.isAvailable(new ScmConnectionSettings(""))).isFalse(); } | @Override public boolean isAvailable(ScmConnectionSettings connectionSettings) { if (connectionSettings == null || Strings.isNullOrEmpty(connectionSettings.getUrl())) { return false; } try { SvnRepositoryFactory.create(connectionSettings).testConnection(); log.info("The given svn server is reachable with connection set... | SvnServerAvailabilityCheckerService implements ScmAvailabilityCheckerService { @Override public boolean isAvailable(ScmConnectionSettings connectionSettings) { if (connectionSettings == null || Strings.isNullOrEmpty(connectionSettings.getUrl())) { return false; } try { SvnRepositoryFactory.create(connectionSettings).te... | SvnServerAvailabilityCheckerService implements ScmAvailabilityCheckerService { @Override public boolean isAvailable(ScmConnectionSettings connectionSettings) { if (connectionSettings == null || Strings.isNullOrEmpty(connectionSettings.getUrl())) { return false; } try { SvnRepositoryFactory.create(connectionSettings).te... | SvnServerAvailabilityCheckerService implements ScmAvailabilityCheckerService { @Override public boolean isAvailable(ScmConnectionSettings connectionSettings) { if (connectionSettings == null || Strings.isNullOrEmpty(connectionSettings.getUrl())) { return false; } try { SvnRepositoryFactory.create(connectionSettings).te... | SvnServerAvailabilityCheckerService implements ScmAvailabilityCheckerService { @Override public boolean isAvailable(ScmConnectionSettings connectionSettings) { if (connectionSettings == null || Strings.isNullOrEmpty(connectionSettings.getUrl())) { return false; } try { SvnRepositoryFactory.create(connectionSettings).te... |
@Test public void shouldParseFilePartOutOfOldPathProperly() throws SVNException { ScmConnectionSettings connectionSettings = new ScmConnectionSettings("http: SvnFileRevision fileRevision = new SvnFileRevision(0L, "/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/reloading/ManagedReload... | String getFilePartOfOldPath(ScmConnectionSettings connectionSettings) throws SVNException { SVNURL svnurl = SVNURL.parseURIEncoded(connectionSettings.getUrl()); List<String> splittedBasePath = splitUrl(svnurl.getPath()); List<String> splittedOldPath = splitUrl(oldPath); int i = 0; boolean foundBeginningOfSomeCommonPart... | SvnFileRevision { String getFilePartOfOldPath(ScmConnectionSettings connectionSettings) throws SVNException { SVNURL svnurl = SVNURL.parseURIEncoded(connectionSettings.getUrl()); List<String> splittedBasePath = splitUrl(svnurl.getPath()); List<String> splittedOldPath = splitUrl(oldPath); int i = 0; boolean foundBeginni... | SvnFileRevision { String getFilePartOfOldPath(ScmConnectionSettings connectionSettings) throws SVNException { SVNURL svnurl = SVNURL.parseURIEncoded(connectionSettings.getUrl()); List<String> splittedBasePath = splitUrl(svnurl.getPath()); List<String> splittedOldPath = splitUrl(oldPath); int i = 0; boolean foundBeginni... | SvnFileRevision { String getFilePartOfOldPath(ScmConnectionSettings connectionSettings) throws SVNException { SVNURL svnurl = SVNURL.parseURIEncoded(connectionSettings.getUrl()); List<String> splittedBasePath = splitUrl(svnurl.getPath()); List<String> splittedOldPath = splitUrl(oldPath); int i = 0; boolean foundBeginni... | SvnFileRevision { String getFilePartOfOldPath(ScmConnectionSettings connectionSettings) throws SVNException { SVNURL svnurl = SVNURL.parseURIEncoded(connectionSettings.getUrl()); List<String> splittedBasePath = splitUrl(svnurl.getPath()); List<String> splittedOldPath = splitUrl(oldPath); int i = 0; boolean foundBeginni... |
@Test public void whenInvestmentIsBiggerThanPossibleOverallProfitOnlyThePossibleProfitShouldBeCalculated() { QualityInvestmentPlan qualityInvestmentPlan = investmentPlanService.computeInvestmentPlan(analysis, "", 100); assertThat(qualityInvestmentPlan.getProfitInMinutes()).isEqualTo(300); assertThat(qualityInvestmentPl... | public QualityInvestmentPlan computeInvestmentPlan(QualityAnalysis analysis, String basePackage, int investmentInMinutes) { Multimap<Double, QualityViolation> violationsByProfit = ArrayListMultimap.create(); for (QualityViolation violation : filterViolationsByArtefactNameStartingWith(basePackage, analysis.getViolations... | QualityInvestmentPlanService { public QualityInvestmentPlan computeInvestmentPlan(QualityAnalysis analysis, String basePackage, int investmentInMinutes) { Multimap<Double, QualityViolation> violationsByProfit = ArrayListMultimap.create(); for (QualityViolation violation : filterViolationsByArtefactNameStartingWith(base... | QualityInvestmentPlanService { public QualityInvestmentPlan computeInvestmentPlan(QualityAnalysis analysis, String basePackage, int investmentInMinutes) { Multimap<Double, QualityViolation> violationsByProfit = ArrayListMultimap.create(); for (QualityViolation violation : filterViolationsByArtefactNameStartingWith(base... | QualityInvestmentPlanService { public QualityInvestmentPlan computeInvestmentPlan(QualityAnalysis analysis, String basePackage, int investmentInMinutes) { Multimap<Double, QualityViolation> violationsByProfit = ArrayListMultimap.create(); for (QualityViolation violation : filterViolationsByArtefactNameStartingWith(base... | QualityInvestmentPlanService { public QualityInvestmentPlan computeInvestmentPlan(QualityAnalysis analysis, String basePackage, int investmentInMinutes) { Multimap<Double, QualityViolation> violationsByProfit = ArrayListMultimap.create(); for (QualityViolation violation : filterViolationsByArtefactNameStartingWith(base... |
@Test public void countLinesWithSuppliedSeparator() { assertThat(new SvnFile("1a2a3", "a").countLines()).isEqualTo(3); } | int countLines() { if (content.isEmpty()) { return 0; } return content.split(lineSeparator).length; } | SvnFile { int countLines() { if (content.isEmpty()) { return 0; } return content.split(lineSeparator).length; } } | SvnFile { int countLines() { if (content.isEmpty()) { return 0; } return content.split(lineSeparator).length; } SvnFile(String content, String lineSeparator); } | SvnFile { int countLines() { if (content.isEmpty()) { return 0; } return content.split(lineSeparator).length; } SvnFile(String content, String lineSeparator); } | SvnFile { int countLines() { if (content.isEmpty()) { return 0; } return content.split(lineSeparator).length; } SvnFile(String content, String lineSeparator); } |
@Test public void shouldNotFailOnEmptyText() { assertThat(new SvnFile("", "a").countLines()).isEqualTo(0); } | int countLines() { if (content.isEmpty()) { return 0; } return content.split(lineSeparator).length; } | SvnFile { int countLines() { if (content.isEmpty()) { return 0; } return content.split(lineSeparator).length; } } | SvnFile { int countLines() { if (content.isEmpty()) { return 0; } return content.split(lineSeparator).length; } SvnFile(String content, String lineSeparator); } | SvnFile { int countLines() { if (content.isEmpty()) { return 0; } return content.split(lineSeparator).length; } SvnFile(String content, String lineSeparator); } | SvnFile { int countLines() { if (content.isEmpty()) { return 0; } return content.split(lineSeparator).length; } SvnFile(String content, String lineSeparator); } |
@Test public void countLineCorrectlyWhenSeparatorConsistsOfManyCharacters() { assertThat(new SvnFile("111abc222abc333", "abc").countLines()).isEqualTo(3); } | int countLines() { if (content.isEmpty()) { return 0; } return content.split(lineSeparator).length; } | SvnFile { int countLines() { if (content.isEmpty()) { return 0; } return content.split(lineSeparator).length; } } | SvnFile { int countLines() { if (content.isEmpty()) { return 0; } return content.split(lineSeparator).length; } SvnFile(String content, String lineSeparator); } | SvnFile { int countLines() { if (content.isEmpty()) { return 0; } return content.split(lineSeparator).length; } SvnFile(String content, String lineSeparator); } | SvnFile { int countLines() { if (content.isEmpty()) { return 0; } return content.split(lineSeparator).length; } SvnFile(String content, String lineSeparator); } |
@Test public void A_is_sorted_before_B() { assertThat(A.compareTo(B)).isEqualTo(comesBefore); } | @Override public int compareTo(Object o) { if (o != null) { ProjectInformation otherProjectInformation = (ProjectInformation) o; if (otherProjectInformation.getName() != null && this.getName() != null) { return this.name.compareToIgnoreCase(otherProjectInformation.getName()); } } return 1; } | ProjectInformation implements Comparable { @Override public int compareTo(Object o) { if (o != null) { ProjectInformation otherProjectInformation = (ProjectInformation) o; if (otherProjectInformation.getName() != null && this.getName() != null) { return this.name.compareToIgnoreCase(otherProjectInformation.getName()); ... | ProjectInformation implements Comparable { @Override public int compareTo(Object o) { if (o != null) { ProjectInformation otherProjectInformation = (ProjectInformation) o; if (otherProjectInformation.getName() != null && this.getName() != null) { return this.name.compareToIgnoreCase(otherProjectInformation.getName()); ... | ProjectInformation implements Comparable { @Override public int compareTo(Object o) { if (o != null) { ProjectInformation otherProjectInformation = (ProjectInformation) o; if (otherProjectInformation.getName() != null && this.getName() != null) { return this.name.compareToIgnoreCase(otherProjectInformation.getName()); ... | ProjectInformation implements Comparable { @Override public int compareTo(Object o) { if (o != null) { ProjectInformation otherProjectInformation = (ProjectInformation) o; if (otherProjectInformation.getName() != null && this.getName() != null) { return this.name.compareToIgnoreCase(otherProjectInformation.getName()); ... |
@Test public void a_is_sorted_before_B() { assertThat(a.compareTo(B)).isEqualTo(comesBefore); } | @Override public int compareTo(Object o) { if (o != null) { ProjectInformation otherProjectInformation = (ProjectInformation) o; if (otherProjectInformation.getName() != null && this.getName() != null) { return this.name.compareToIgnoreCase(otherProjectInformation.getName()); } } return 1; } | ProjectInformation implements Comparable { @Override public int compareTo(Object o) { if (o != null) { ProjectInformation otherProjectInformation = (ProjectInformation) o; if (otherProjectInformation.getName() != null && this.getName() != null) { return this.name.compareToIgnoreCase(otherProjectInformation.getName()); ... | ProjectInformation implements Comparable { @Override public int compareTo(Object o) { if (o != null) { ProjectInformation otherProjectInformation = (ProjectInformation) o; if (otherProjectInformation.getName() != null && this.getName() != null) { return this.name.compareToIgnoreCase(otherProjectInformation.getName()); ... | ProjectInformation implements Comparable { @Override public int compareTo(Object o) { if (o != null) { ProjectInformation otherProjectInformation = (ProjectInformation) o; if (otherProjectInformation.getName() != null && this.getName() != null) { return this.name.compareToIgnoreCase(otherProjectInformation.getName()); ... | ProjectInformation implements Comparable { @Override public int compareTo(Object o) { if (o != null) { ProjectInformation otherProjectInformation = (ProjectInformation) o; if (otherProjectInformation.getName() != null && this.getName() != null) { return this.name.compareToIgnoreCase(otherProjectInformation.getName()); ... |
@Test public void B_is_sorted_after_A() { assertThat(B.compareTo(A)).isEqualTo(comesAfter); } | @Override public int compareTo(Object o) { if (o != null) { ProjectInformation otherProjectInformation = (ProjectInformation) o; if (otherProjectInformation.getName() != null && this.getName() != null) { return this.name.compareToIgnoreCase(otherProjectInformation.getName()); } } return 1; } | ProjectInformation implements Comparable { @Override public int compareTo(Object o) { if (o != null) { ProjectInformation otherProjectInformation = (ProjectInformation) o; if (otherProjectInformation.getName() != null && this.getName() != null) { return this.name.compareToIgnoreCase(otherProjectInformation.getName()); ... | ProjectInformation implements Comparable { @Override public int compareTo(Object o) { if (o != null) { ProjectInformation otherProjectInformation = (ProjectInformation) o; if (otherProjectInformation.getName() != null && this.getName() != null) { return this.name.compareToIgnoreCase(otherProjectInformation.getName()); ... | ProjectInformation implements Comparable { @Override public int compareTo(Object o) { if (o != null) { ProjectInformation otherProjectInformation = (ProjectInformation) o; if (otherProjectInformation.getName() != null && this.getName() != null) { return this.name.compareToIgnoreCase(otherProjectInformation.getName()); ... | ProjectInformation implements Comparable { @Override public int compareTo(Object o) { if (o != null) { ProjectInformation otherProjectInformation = (ProjectInformation) o; if (otherProjectInformation.getName() != null && this.getName() != null) { return this.name.compareToIgnoreCase(otherProjectInformation.getName()); ... |
@Test public void A_and_a_are_the_same() { assertThat(a.compareTo(A)).isEqualTo(areTheSame); } | @Override public int compareTo(Object o) { if (o != null) { ProjectInformation otherProjectInformation = (ProjectInformation) o; if (otherProjectInformation.getName() != null && this.getName() != null) { return this.name.compareToIgnoreCase(otherProjectInformation.getName()); } } return 1; } | ProjectInformation implements Comparable { @Override public int compareTo(Object o) { if (o != null) { ProjectInformation otherProjectInformation = (ProjectInformation) o; if (otherProjectInformation.getName() != null && this.getName() != null) { return this.name.compareToIgnoreCase(otherProjectInformation.getName()); ... | ProjectInformation implements Comparable { @Override public int compareTo(Object o) { if (o != null) { ProjectInformation otherProjectInformation = (ProjectInformation) o; if (otherProjectInformation.getName() != null && this.getName() != null) { return this.name.compareToIgnoreCase(otherProjectInformation.getName()); ... | ProjectInformation implements Comparable { @Override public int compareTo(Object o) { if (o != null) { ProjectInformation otherProjectInformation = (ProjectInformation) o; if (otherProjectInformation.getName() != null && this.getName() != null) { return this.name.compareToIgnoreCase(otherProjectInformation.getName()); ... | ProjectInformation implements Comparable { @Override public int compareTo(Object o) { if (o != null) { ProjectInformation otherProjectInformation = (ProjectInformation) o; if (otherProjectInformation.getName() != null && this.getName() != null) { return this.name.compareToIgnoreCase(otherProjectInformation.getName()); ... |
@Test public void compared_to_null_is_the_same() { assertThat(B.compareTo(null)).isEqualTo(comesAfter); } | @Override public int compareTo(Object o) { if (o != null) { ProjectInformation otherProjectInformation = (ProjectInformation) o; if (otherProjectInformation.getName() != null && this.getName() != null) { return this.name.compareToIgnoreCase(otherProjectInformation.getName()); } } return 1; } | ProjectInformation implements Comparable { @Override public int compareTo(Object o) { if (o != null) { ProjectInformation otherProjectInformation = (ProjectInformation) o; if (otherProjectInformation.getName() != null && this.getName() != null) { return this.name.compareToIgnoreCase(otherProjectInformation.getName()); ... | ProjectInformation implements Comparable { @Override public int compareTo(Object o) { if (o != null) { ProjectInformation otherProjectInformation = (ProjectInformation) o; if (otherProjectInformation.getName() != null && this.getName() != null) { return this.name.compareToIgnoreCase(otherProjectInformation.getName()); ... | ProjectInformation implements Comparable { @Override public int compareTo(Object o) { if (o != null) { ProjectInformation otherProjectInformation = (ProjectInformation) o; if (otherProjectInformation.getName() != null && this.getName() != null) { return this.name.compareToIgnoreCase(otherProjectInformation.getName()); ... | ProjectInformation implements Comparable { @Override public int compareTo(Object o) { if (o != null) { ProjectInformation otherProjectInformation = (ProjectInformation) o; if (otherProjectInformation.getName() != null && this.getName() != null) { return this.name.compareToIgnoreCase(otherProjectInformation.getName()); ... |
@Test public void compared_to_null_name_is_sorted_after() { assertThat(B.compareTo(nullName)).isEqualTo(comesAfter); } | @Override public int compareTo(Object o) { if (o != null) { ProjectInformation otherProjectInformation = (ProjectInformation) o; if (otherProjectInformation.getName() != null && this.getName() != null) { return this.name.compareToIgnoreCase(otherProjectInformation.getName()); } } return 1; } | ProjectInformation implements Comparable { @Override public int compareTo(Object o) { if (o != null) { ProjectInformation otherProjectInformation = (ProjectInformation) o; if (otherProjectInformation.getName() != null && this.getName() != null) { return this.name.compareToIgnoreCase(otherProjectInformation.getName()); ... | ProjectInformation implements Comparable { @Override public int compareTo(Object o) { if (o != null) { ProjectInformation otherProjectInformation = (ProjectInformation) o; if (otherProjectInformation.getName() != null && this.getName() != null) { return this.name.compareToIgnoreCase(otherProjectInformation.getName()); ... | ProjectInformation implements Comparable { @Override public int compareTo(Object o) { if (o != null) { ProjectInformation otherProjectInformation = (ProjectInformation) o; if (otherProjectInformation.getName() != null && this.getName() != null) { return this.name.compareToIgnoreCase(otherProjectInformation.getName()); ... | ProjectInformation implements Comparable { @Override public int compareTo(Object o) { if (o != null) { ProjectInformation otherProjectInformation = (ProjectInformation) o; if (otherProjectInformation.getName() != null && this.getName() != null) { return this.name.compareToIgnoreCase(otherProjectInformation.getName()); ... |
@Test public void compared__valid_projectInfo_to_null_is_sorted_after() { assertThat(nullName.compareTo(A)).isEqualTo(comesAfter); } | @Override public int compareTo(Object o) { if (o != null) { ProjectInformation otherProjectInformation = (ProjectInformation) o; if (otherProjectInformation.getName() != null && this.getName() != null) { return this.name.compareToIgnoreCase(otherProjectInformation.getName()); } } return 1; } | ProjectInformation implements Comparable { @Override public int compareTo(Object o) { if (o != null) { ProjectInformation otherProjectInformation = (ProjectInformation) o; if (otherProjectInformation.getName() != null && this.getName() != null) { return this.name.compareToIgnoreCase(otherProjectInformation.getName()); ... | ProjectInformation implements Comparable { @Override public int compareTo(Object o) { if (o != null) { ProjectInformation otherProjectInformation = (ProjectInformation) o; if (otherProjectInformation.getName() != null && this.getName() != null) { return this.name.compareToIgnoreCase(otherProjectInformation.getName()); ... | ProjectInformation implements Comparable { @Override public int compareTo(Object o) { if (o != null) { ProjectInformation otherProjectInformation = (ProjectInformation) o; if (otherProjectInformation.getName() != null && this.getName() != null) { return this.name.compareToIgnoreCase(otherProjectInformation.getName()); ... | ProjectInformation implements Comparable { @Override public int compareTo(Object o) { if (o != null) { ProjectInformation otherProjectInformation = (ProjectInformation) o; if (otherProjectInformation.getName() != null && this.getName() != null) { return this.name.compareToIgnoreCase(otherProjectInformation.getName()); ... |
@Test public void whenInvestmentIsSmallerThanPossibleOverallProfitOnlyTheInvestedAmountShouldBeCalculated() { QualityInvestmentPlan qualityInvestmentPlan = investmentPlanService.computeInvestmentPlan(analysis, "", 35); assertThat(qualityInvestmentPlan.getProfitInMinutes()).isEqualTo(220); assertThat(qualityInvestmentPl... | public QualityInvestmentPlan computeInvestmentPlan(QualityAnalysis analysis, String basePackage, int investmentInMinutes) { Multimap<Double, QualityViolation> violationsByProfit = ArrayListMultimap.create(); for (QualityViolation violation : filterViolationsByArtefactNameStartingWith(basePackage, analysis.getViolations... | QualityInvestmentPlanService { public QualityInvestmentPlan computeInvestmentPlan(QualityAnalysis analysis, String basePackage, int investmentInMinutes) { Multimap<Double, QualityViolation> violationsByProfit = ArrayListMultimap.create(); for (QualityViolation violation : filterViolationsByArtefactNameStartingWith(base... | QualityInvestmentPlanService { public QualityInvestmentPlan computeInvestmentPlan(QualityAnalysis analysis, String basePackage, int investmentInMinutes) { Multimap<Double, QualityViolation> violationsByProfit = ArrayListMultimap.create(); for (QualityViolation violation : filterViolationsByArtefactNameStartingWith(base... | QualityInvestmentPlanService { public QualityInvestmentPlan computeInvestmentPlan(QualityAnalysis analysis, String basePackage, int investmentInMinutes) { Multimap<Double, QualityViolation> violationsByProfit = ArrayListMultimap.create(); for (QualityViolation violation : filterViolationsByArtefactNameStartingWith(base... | QualityInvestmentPlanService { public QualityInvestmentPlan computeInvestmentPlan(QualityAnalysis analysis, String basePackage, int investmentInMinutes) { Multimap<Double, QualityViolation> violationsByProfit = ArrayListMultimap.create(); for (QualityViolation violation : filterViolationsByArtefactNameStartingWith(base... |
@Test(expected = IllegalArgumentException.class) public void shouldFailWhenConnectionSettingsMissProjectAttribute() throws ResourceNotFoundException { new MetricCollectorService().collectMetricForResource(new SonarConnectionSettings("dummy"), "", ""); } | public double collectMetricForResource(SonarConnectionSettings connectionSettings, String resourceKey, String metricIdentifier) throws ResourceNotFoundException { if (!connectionSettings.hasProject()) { throw new IllegalArgumentException("you can only collect metric value for a resource with connection settings that ha... | MetricCollectorService { public double collectMetricForResource(SonarConnectionSettings connectionSettings, String resourceKey, String metricIdentifier) throws ResourceNotFoundException { if (!connectionSettings.hasProject()) { throw new IllegalArgumentException("you can only collect metric value for a resource with co... | MetricCollectorService { public double collectMetricForResource(SonarConnectionSettings connectionSettings, String resourceKey, String metricIdentifier) throws ResourceNotFoundException { if (!connectionSettings.hasProject()) { throw new IllegalArgumentException("you can only collect metric value for a resource with co... | MetricCollectorService { public double collectMetricForResource(SonarConnectionSettings connectionSettings, String resourceKey, String metricIdentifier) throws ResourceNotFoundException { if (!connectionSettings.hasProject()) { throw new IllegalArgumentException("you can only collect metric value for a resource with co... | MetricCollectorService { public double collectMetricForResource(SonarConnectionSettings connectionSettings, String resourceKey, String metricIdentifier) throws ResourceNotFoundException { if (!connectionSettings.hasProject()) { throw new IllegalArgumentException("you can only collect metric value for a resource with co... |
@Test(expected = IllegalArgumentException.class) public void shouldFailWhenConnectionSettingsMissProjectAttribute() { new ResourcesCollectorService().collectAllResourcesForProject(new SonarConnectionSettings("dummy")); } | public Collection<Resource> collectAllResourcesForProject(SonarConnectionSettings connectionSettings) { if (!connectionSettings.hasProject()) { throw new IllegalArgumentException("you can only collect resources with connection settings that has a project"); } log.info("Start collecting all classes for project {} at Son... | ResourcesCollectorService { public Collection<Resource> collectAllResourcesForProject(SonarConnectionSettings connectionSettings) { if (!connectionSettings.hasProject()) { throw new IllegalArgumentException("you can only collect resources with connection settings that has a project"); } log.info("Start collecting all c... | ResourcesCollectorService { public Collection<Resource> collectAllResourcesForProject(SonarConnectionSettings connectionSettings) { if (!connectionSettings.hasProject()) { throw new IllegalArgumentException("you can only collect resources with connection settings that has a project"); } log.info("Start collecting all c... | ResourcesCollectorService { public Collection<Resource> collectAllResourcesForProject(SonarConnectionSettings connectionSettings) { if (!connectionSettings.hasProject()) { throw new IllegalArgumentException("you can only collect resources with connection settings that has a project"); } log.info("Start collecting all c... | ResourcesCollectorService { public Collection<Resource> collectAllResourcesForProject(SonarConnectionSettings connectionSettings) { if (!connectionSettings.hasProject()) { throw new IllegalArgumentException("you can only collect resources with connection settings that has a project"); } log.info("Start collecting all c... |
@Test public void notReachableWhenConnectionSettingsAreNull() { assertThat(sonarConnectionCheckerService.isReachable(null)).isFalse(); } | public boolean isReachable(SonarConnectionSettings connectionSettings) { if (connectionSettings == null || Strings.isNullOrEmpty(connectionSettings.getUrl())) { return false; } HttpClient4Connector connector = new HttpClient4Connector(connectionSettings.asHostObject()); try { return connector.getHttpClient() .execute(n... | SonarConnectionCheckerService { public boolean isReachable(SonarConnectionSettings connectionSettings) { if (connectionSettings == null || Strings.isNullOrEmpty(connectionSettings.getUrl())) { return false; } HttpClient4Connector connector = new HttpClient4Connector(connectionSettings.asHostObject()); try { return conn... | SonarConnectionCheckerService { public boolean isReachable(SonarConnectionSettings connectionSettings) { if (connectionSettings == null || Strings.isNullOrEmpty(connectionSettings.getUrl())) { return false; } HttpClient4Connector connector = new HttpClient4Connector(connectionSettings.asHostObject()); try { return conn... | SonarConnectionCheckerService { public boolean isReachable(SonarConnectionSettings connectionSettings) { if (connectionSettings == null || Strings.isNullOrEmpty(connectionSettings.getUrl())) { return false; } HttpClient4Connector connector = new HttpClient4Connector(connectionSettings.asHostObject()); try { return conn... | SonarConnectionCheckerService { public boolean isReachable(SonarConnectionSettings connectionSettings) { if (connectionSettings == null || Strings.isNullOrEmpty(connectionSettings.getUrl())) { return false; } HttpClient4Connector connector = new HttpClient4Connector(connectionSettings.asHostObject()); try { return conn... |
@Test public void notReachableWhenUrlOfConnectionSettingsIsNull() { assertThat(sonarConnectionCheckerService.isReachable(new SonarConnectionSettings(null))).isFalse(); } | public boolean isReachable(SonarConnectionSettings connectionSettings) { if (connectionSettings == null || Strings.isNullOrEmpty(connectionSettings.getUrl())) { return false; } HttpClient4Connector connector = new HttpClient4Connector(connectionSettings.asHostObject()); try { return connector.getHttpClient() .execute(n... | SonarConnectionCheckerService { public boolean isReachable(SonarConnectionSettings connectionSettings) { if (connectionSettings == null || Strings.isNullOrEmpty(connectionSettings.getUrl())) { return false; } HttpClient4Connector connector = new HttpClient4Connector(connectionSettings.asHostObject()); try { return conn... | SonarConnectionCheckerService { public boolean isReachable(SonarConnectionSettings connectionSettings) { if (connectionSettings == null || Strings.isNullOrEmpty(connectionSettings.getUrl())) { return false; } HttpClient4Connector connector = new HttpClient4Connector(connectionSettings.asHostObject()); try { return conn... | SonarConnectionCheckerService { public boolean isReachable(SonarConnectionSettings connectionSettings) { if (connectionSettings == null || Strings.isNullOrEmpty(connectionSettings.getUrl())) { return false; } HttpClient4Connector connector = new HttpClient4Connector(connectionSettings.asHostObject()); try { return conn... | SonarConnectionCheckerService { public boolean isReachable(SonarConnectionSettings connectionSettings) { if (connectionSettings == null || Strings.isNullOrEmpty(connectionSettings.getUrl())) { return false; } HttpClient4Connector connector = new HttpClient4Connector(connectionSettings.asHostObject()); try { return conn... |
@Test public void notReachableWhenUrlOfConnectionSettingsIsEmpty() { assertThat(sonarConnectionCheckerService.isReachable(new SonarConnectionSettings(""))).isFalse(); } | public boolean isReachable(SonarConnectionSettings connectionSettings) { if (connectionSettings == null || Strings.isNullOrEmpty(connectionSettings.getUrl())) { return false; } HttpClient4Connector connector = new HttpClient4Connector(connectionSettings.asHostObject()); try { return connector.getHttpClient() .execute(n... | SonarConnectionCheckerService { public boolean isReachable(SonarConnectionSettings connectionSettings) { if (connectionSettings == null || Strings.isNullOrEmpty(connectionSettings.getUrl())) { return false; } HttpClient4Connector connector = new HttpClient4Connector(connectionSettings.asHostObject()); try { return conn... | SonarConnectionCheckerService { public boolean isReachable(SonarConnectionSettings connectionSettings) { if (connectionSettings == null || Strings.isNullOrEmpty(connectionSettings.getUrl())) { return false; } HttpClient4Connector connector = new HttpClient4Connector(connectionSettings.asHostObject()); try { return conn... | SonarConnectionCheckerService { public boolean isReachable(SonarConnectionSettings connectionSettings) { if (connectionSettings == null || Strings.isNullOrEmpty(connectionSettings.getUrl())) { return false; } HttpClient4Connector connector = new HttpClient4Connector(connectionSettings.asHostObject()); try { return conn... | SonarConnectionCheckerService { public boolean isReachable(SonarConnectionSettings connectionSettings) { if (connectionSettings == null || Strings.isNullOrEmpty(connectionSettings.getUrl())) { return false; } HttpClient4Connector connector = new HttpClient4Connector(connectionSettings.asHostObject()); try { return conn... |
@Test public void succeededAnalysisWithOneViolation() throws CodeChurnCalculationException, ScmConnectionEncodingException { Artefact artefact = new Artefact("A", "A"); QualityAnalyzerService qualityAnalyzerService = createMockedSystemWithArtefactsAndViolations( Arrays.asList(new ViolationOccurence(firstRequirement, ar... | @Override public QualityAnalysis analyzeProject(Project project) { try { ViolationsAnalysisResult violationsAnalysisResult = violationsCalculatorService.calculateAllViolation(project); if (!violationsAnalysisResult.isSuccessful()) { log.error("Quality analysis for project {} failed due '{}'", project.getName(), violati... | DefaultQualityAnalyzerService implements QualityAnalyzerService { @Override public QualityAnalysis analyzeProject(Project project) { try { ViolationsAnalysisResult violationsAnalysisResult = violationsCalculatorService.calculateAllViolation(project); if (!violationsAnalysisResult.isSuccessful()) { log.error("Quality an... | DefaultQualityAnalyzerService implements QualityAnalyzerService { @Override public QualityAnalysis analyzeProject(Project project) { try { ViolationsAnalysisResult violationsAnalysisResult = violationsCalculatorService.calculateAllViolation(project); if (!violationsAnalysisResult.isSuccessful()) { log.error("Quality an... | DefaultQualityAnalyzerService implements QualityAnalyzerService { @Override public QualityAnalysis analyzeProject(Project project) { try { ViolationsAnalysisResult violationsAnalysisResult = violationsCalculatorService.calculateAllViolation(project); if (!violationsAnalysisResult.isSuccessful()) { log.error("Quality an... | DefaultQualityAnalyzerService implements QualityAnalyzerService { @Override public QualityAnalysis analyzeProject(Project project) { try { ViolationsAnalysisResult violationsAnalysisResult = violationsCalculatorService.calculateAllViolation(project); if (!violationsAnalysisResult.isSuccessful()) { log.error("Quality an... |
@Test public void succeededAnalysisWithManyViolations() throws CodeChurnCalculationException, ScmConnectionEncodingException { Artefact artefactA = new Artefact("A", "A"); Artefact artefactB = new Artefact("B", "B"); Artefact artefactC = new Artefact("C", "C"); QualityAnalyzerService qualityAnalyzerService = createMock... | @Override public QualityAnalysis analyzeProject(Project project) { try { ViolationsAnalysisResult violationsAnalysisResult = violationsCalculatorService.calculateAllViolation(project); if (!violationsAnalysisResult.isSuccessful()) { log.error("Quality analysis for project {} failed due '{}'", project.getName(), violati... | DefaultQualityAnalyzerService implements QualityAnalyzerService { @Override public QualityAnalysis analyzeProject(Project project) { try { ViolationsAnalysisResult violationsAnalysisResult = violationsCalculatorService.calculateAllViolation(project); if (!violationsAnalysisResult.isSuccessful()) { log.error("Quality an... | DefaultQualityAnalyzerService implements QualityAnalyzerService { @Override public QualityAnalysis analyzeProject(Project project) { try { ViolationsAnalysisResult violationsAnalysisResult = violationsCalculatorService.calculateAllViolation(project); if (!violationsAnalysisResult.isSuccessful()) { log.error("Quality an... | DefaultQualityAnalyzerService implements QualityAnalyzerService { @Override public QualityAnalysis analyzeProject(Project project) { try { ViolationsAnalysisResult violationsAnalysisResult = violationsCalculatorService.calculateAllViolation(project); if (!violationsAnalysisResult.isSuccessful()) { log.error("Quality an... | DefaultQualityAnalyzerService implements QualityAnalyzerService { @Override public QualityAnalysis analyzeProject(Project project) { try { ViolationsAnalysisResult violationsAnalysisResult = violationsCalculatorService.calculateAllViolation(project); if (!violationsAnalysisResult.isSuccessful()) { log.error("Quality an... |
@Test public void addCodeChangeProbabilityToArtefacts() throws CodeChurnCalculationException, ScmConnectionEncodingException, ResourceNotFoundException { Artefact artefactA = new Artefact("A", "A"); Artefact artefactB = new Artefact("B", "B"); ViolationOccurence violationA = new ViolationOccurence(firstRequirement, art... | @Override public QualityAnalysis analyzeProject(Project project) { try { ViolationsAnalysisResult violationsAnalysisResult = violationsCalculatorService.calculateAllViolation(project); if (!violationsAnalysisResult.isSuccessful()) { log.error("Quality analysis for project {} failed due '{}'", project.getName(), violati... | DefaultQualityAnalyzerService implements QualityAnalyzerService { @Override public QualityAnalysis analyzeProject(Project project) { try { ViolationsAnalysisResult violationsAnalysisResult = violationsCalculatorService.calculateAllViolation(project); if (!violationsAnalysisResult.isSuccessful()) { log.error("Quality an... | DefaultQualityAnalyzerService implements QualityAnalyzerService { @Override public QualityAnalysis analyzeProject(Project project) { try { ViolationsAnalysisResult violationsAnalysisResult = violationsCalculatorService.calculateAllViolation(project); if (!violationsAnalysisResult.isSuccessful()) { log.error("Quality an... | DefaultQualityAnalyzerService implements QualityAnalyzerService { @Override public QualityAnalysis analyzeProject(Project project) { try { ViolationsAnalysisResult violationsAnalysisResult = violationsCalculatorService.calculateAllViolation(project); if (!violationsAnalysisResult.isSuccessful()) { log.error("Quality an... | DefaultQualityAnalyzerService implements QualityAnalyzerService { @Override public QualityAnalysis analyzeProject(Project project) { try { ViolationsAnalysisResult violationsAnalysisResult = violationsCalculatorService.calculateAllViolation(project); if (!violationsAnalysisResult.isSuccessful()) { log.error("Quality an... |
@Test public void addSecureChangeProbabilityToArtefacts() throws CodeChurnCalculationException, ScmConnectionEncodingException, ResourceNotFoundException { Artefact artefactA = new Artefact("A", "A"); Artefact artefactB = new Artefact("B", "B"); ViolationOccurence violationA = new ViolationOccurence(firstRequirement, a... | @Override public QualityAnalysis analyzeProject(Project project) { try { ViolationsAnalysisResult violationsAnalysisResult = violationsCalculatorService.calculateAllViolation(project); if (!violationsAnalysisResult.isSuccessful()) { log.error("Quality analysis for project {} failed due '{}'", project.getName(), violati... | DefaultQualityAnalyzerService implements QualityAnalyzerService { @Override public QualityAnalysis analyzeProject(Project project) { try { ViolationsAnalysisResult violationsAnalysisResult = violationsCalculatorService.calculateAllViolation(project); if (!violationsAnalysisResult.isSuccessful()) { log.error("Quality an... | DefaultQualityAnalyzerService implements QualityAnalyzerService { @Override public QualityAnalysis analyzeProject(Project project) { try { ViolationsAnalysisResult violationsAnalysisResult = violationsCalculatorService.calculateAllViolation(project); if (!violationsAnalysisResult.isSuccessful()) { log.error("Quality an... | DefaultQualityAnalyzerService implements QualityAnalyzerService { @Override public QualityAnalysis analyzeProject(Project project) { try { ViolationsAnalysisResult violationsAnalysisResult = violationsCalculatorService.calculateAllViolation(project); if (!violationsAnalysisResult.isSuccessful()) { log.error("Quality an... | DefaultQualityAnalyzerService implements QualityAnalyzerService { @Override public QualityAnalysis analyzeProject(Project project) { try { ViolationsAnalysisResult violationsAnalysisResult = violationsCalculatorService.calculateAllViolation(project); if (!violationsAnalysisResult.isSuccessful()) { log.error("Quality an... |
@Test public void failedAnalysisWhenSecureChangeProbabilityCalculatorThrowsResourceNotFoundException() throws CodeChurnCalculationException, ScmConnectionEncodingException, ResourceNotFoundException { ViolationOccurence violation = new ViolationOccurence(firstRequirement, new Artefact("A", "A"), 0); ViolationsCalculato... | @Override public QualityAnalysis analyzeProject(Project project) { try { ViolationsAnalysisResult violationsAnalysisResult = violationsCalculatorService.calculateAllViolation(project); if (!violationsAnalysisResult.isSuccessful()) { log.error("Quality analysis for project {} failed due '{}'", project.getName(), violati... | DefaultQualityAnalyzerService implements QualityAnalyzerService { @Override public QualityAnalysis analyzeProject(Project project) { try { ViolationsAnalysisResult violationsAnalysisResult = violationsCalculatorService.calculateAllViolation(project); if (!violationsAnalysisResult.isSuccessful()) { log.error("Quality an... | DefaultQualityAnalyzerService implements QualityAnalyzerService { @Override public QualityAnalysis analyzeProject(Project project) { try { ViolationsAnalysisResult violationsAnalysisResult = violationsCalculatorService.calculateAllViolation(project); if (!violationsAnalysisResult.isSuccessful()) { log.error("Quality an... | DefaultQualityAnalyzerService implements QualityAnalyzerService { @Override public QualityAnalysis analyzeProject(Project project) { try { ViolationsAnalysisResult violationsAnalysisResult = violationsCalculatorService.calculateAllViolation(project); if (!violationsAnalysisResult.isSuccessful()) { log.error("Quality an... | DefaultQualityAnalyzerService implements QualityAnalyzerService { @Override public QualityAnalysis analyzeProject(Project project) { try { ViolationsAnalysisResult violationsAnalysisResult = violationsCalculatorService.calculateAllViolation(project); if (!violationsAnalysisResult.isSuccessful()) { log.error("Quality an... |
@Test public void calculatesRoiBasedOnRemediationCostsAndProfit() { QualityInvestmentPlan qualityInvestmentPlan = investmentPlanService.computeInvestmentPlan(analysis, "", 80); assertThat(qualityInvestmentPlan.getRoi()).isEqualTo(375); } | public QualityInvestmentPlan computeInvestmentPlan(QualityAnalysis analysis, String basePackage, int investmentInMinutes) { Multimap<Double, QualityViolation> violationsByProfit = ArrayListMultimap.create(); for (QualityViolation violation : filterViolationsByArtefactNameStartingWith(basePackage, analysis.getViolations... | QualityInvestmentPlanService { public QualityInvestmentPlan computeInvestmentPlan(QualityAnalysis analysis, String basePackage, int investmentInMinutes) { Multimap<Double, QualityViolation> violationsByProfit = ArrayListMultimap.create(); for (QualityViolation violation : filterViolationsByArtefactNameStartingWith(base... | QualityInvestmentPlanService { public QualityInvestmentPlan computeInvestmentPlan(QualityAnalysis analysis, String basePackage, int investmentInMinutes) { Multimap<Double, QualityViolation> violationsByProfit = ArrayListMultimap.create(); for (QualityViolation violation : filterViolationsByArtefactNameStartingWith(base... | QualityInvestmentPlanService { public QualityInvestmentPlan computeInvestmentPlan(QualityAnalysis analysis, String basePackage, int investmentInMinutes) { Multimap<Double, QualityViolation> violationsByProfit = ArrayListMultimap.create(); for (QualityViolation violation : filterViolationsByArtefactNameStartingWith(base... | QualityInvestmentPlanService { public QualityInvestmentPlan computeInvestmentPlan(QualityAnalysis analysis, String basePackage, int investmentInMinutes) { Multimap<Double, QualityViolation> violationsByProfit = ArrayListMultimap.create(); for (QualityViolation violation : filterViolationsByArtefactNameStartingWith(base... |
@Test public void takeCostsFromSuppliedCostCalculator() throws CodeChurnCalculationException, ScmConnectionEncodingException, ResourceNotFoundException { ViolationOccurence violation = new ViolationOccurence(firstRequirement, new Artefact("A", "A"), 0); ViolationsCalculatorService violationsCalculatorService = mock(Vio... | @Override public QualityAnalysis analyzeProject(Project project) { try { ViolationsAnalysisResult violationsAnalysisResult = violationsCalculatorService.calculateAllViolation(project); if (!violationsAnalysisResult.isSuccessful()) { log.error("Quality analysis for project {} failed due '{}'", project.getName(), violati... | DefaultQualityAnalyzerService implements QualityAnalyzerService { @Override public QualityAnalysis analyzeProject(Project project) { try { ViolationsAnalysisResult violationsAnalysisResult = violationsCalculatorService.calculateAllViolation(project); if (!violationsAnalysisResult.isSuccessful()) { log.error("Quality an... | DefaultQualityAnalyzerService implements QualityAnalyzerService { @Override public QualityAnalysis analyzeProject(Project project) { try { ViolationsAnalysisResult violationsAnalysisResult = violationsCalculatorService.calculateAllViolation(project); if (!violationsAnalysisResult.isSuccessful()) { log.error("Quality an... | DefaultQualityAnalyzerService implements QualityAnalyzerService { @Override public QualityAnalysis analyzeProject(Project project) { try { ViolationsAnalysisResult violationsAnalysisResult = violationsCalculatorService.calculateAllViolation(project); if (!violationsAnalysisResult.isSuccessful()) { log.error("Quality an... | DefaultQualityAnalyzerService implements QualityAnalyzerService { @Override public QualityAnalysis analyzeProject(Project project) { try { ViolationsAnalysisResult violationsAnalysisResult = violationsCalculatorService.calculateAllViolation(project); if (!violationsAnalysisResult.isSuccessful()) { log.error("Quality an... |
@Test public void failedAnalysisWhenViolationAnalysisWasNotSuccessful() throws CodeChurnCalculationException, ScmConnectionEncodingException { ViolationsCalculatorService violationsCalculatorService = mock(ViolationsCalculatorService.class); when(violationsCalculatorService.calculateAllViolation(any(Project.class))) .t... | @Override public QualityAnalysis analyzeProject(Project project) { try { ViolationsAnalysisResult violationsAnalysisResult = violationsCalculatorService.calculateAllViolation(project); if (!violationsAnalysisResult.isSuccessful()) { log.error("Quality analysis for project {} failed due '{}'", project.getName(), violati... | DefaultQualityAnalyzerService implements QualityAnalyzerService { @Override public QualityAnalysis analyzeProject(Project project) { try { ViolationsAnalysisResult violationsAnalysisResult = violationsCalculatorService.calculateAllViolation(project); if (!violationsAnalysisResult.isSuccessful()) { log.error("Quality an... | DefaultQualityAnalyzerService implements QualityAnalyzerService { @Override public QualityAnalysis analyzeProject(Project project) { try { ViolationsAnalysisResult violationsAnalysisResult = violationsCalculatorService.calculateAllViolation(project); if (!violationsAnalysisResult.isSuccessful()) { log.error("Quality an... | DefaultQualityAnalyzerService implements QualityAnalyzerService { @Override public QualityAnalysis analyzeProject(Project project) { try { ViolationsAnalysisResult violationsAnalysisResult = violationsCalculatorService.calculateAllViolation(project); if (!violationsAnalysisResult.isSuccessful()) { log.error("Quality an... | DefaultQualityAnalyzerService implements QualityAnalyzerService { @Override public QualityAnalysis analyzeProject(Project project) { try { ViolationsAnalysisResult violationsAnalysisResult = violationsCalculatorService.calculateAllViolation(project); if (!violationsAnalysisResult.isSuccessful()) { log.error("Quality an... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.