method2testcases stringlengths 118 6.63k |
|---|
### Question:
SwaggerBasePathRewritingFilter extends SendResponseFilter { @Override public boolean shouldFilter() { return RequestContext.getCurrentContext().getRequest().getRequestURI().endsWith(Swagger2Controller.DEFAULT_URL); } SwaggerBasePathRewritingFilter(); @Override String filterType(); @Override int filterOrde... |
### Question:
SwaggerBasePathRewritingFilter extends SendResponseFilter { @Override public Object run() { RequestContext context = RequestContext.getCurrentContext(); context.getResponse().setCharacterEncoding("UTF-8"); String rewrittenResponse = rewriteBasePath(context); if (context.getResponseGZipped()) { try { conte... |
### Question:
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(); }### A... |
### Question:
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(); }#... |
### Question:
TshirtSizeController { @RequestMapping(value ="convertSize", method = RequestMethod.GET) public int convertSize(@RequestParam(value = "label") final String label, @RequestParam(value = "countryCode", required = false) final String countryCode) { return service.convertSize(label, countryCode); } TshirtSize... |
### Question:
Order { public Order id(Long id) { this.id = id; return this; } Order id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); Order petId(Long petId); @javax.annotation.... |
### Question:
Order { public Order petId(Long petId) { this.petId = petId; return this; } Order id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); Order petId(Long petId); @javax... |
### Question:
Order { public Order quantity(Integer quantity) { this.quantity = quantity; return this; } Order id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); Order petId(Long... |
### Question:
Order { public Order shipDate(OffsetDateTime shipDate) { this.shipDate = shipDate; return this; } Order id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); Order pet... |
### Question:
Order { public Order status(StatusEnum status) { this.status = status; return this; } Order id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); Order petId(Long petI... |
### Question:
Order { public Order complete(Boolean complete) { this.complete = complete; return this; } Order id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); Order petId(Long... |
### Question:
User { public User id(Long id) { this.id = id; return this; } User id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); User username(String username); @javax.annotat... |
### Question:
User { public User username(String username) { this.username = username; return this; } User id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); User username(String... |
### Question:
User { public User firstName(String firstName) { this.firstName = firstName; return this; } User id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); User username(St... |
### Question:
User { public User lastName(String lastName) { this.lastName = lastName; return this; } User id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); User username(String... |
### Question:
User { public User email(String email) { this.email = email; return this; } User id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); User username(String username); ... |
### Question:
User { public User password(String password) { this.password = password; return this; } User id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); User username(String... |
### Question:
User { public User phone(String phone) { this.phone = phone; return this; } User id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); User username(String username); ... |
### Question:
User { public User userStatus(Integer userStatus) { this.userStatus = userStatus; return this; } User id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); User userna... |
### Question:
Pet { public Pet id(Long id) { this.id = id; return this; } Pet id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); Pet category(Category category); @javax.annotatio... |
### Question:
Pet { public Pet category(Category category) { this.category = category; return this; } Pet id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); Pet category(Category... |
### Question:
Pet { public Pet name(String name) { this.name = name; return this; } Pet id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); Pet category(Category category); @javax... |
### Question:
Pet { public Pet photoUrls(List<String> photoUrls) { this.photoUrls = photoUrls; return this; } Pet id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); Pet category(... |
### Question:
Pet { public Pet tags(List<Tag> tags) { this.tags = tags; return this; } Pet id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); Pet category(Category category); @ja... |
### Question:
Pet { public Pet status(StatusEnum status) { this.status = status; return this; } Pet id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); Pet category(Category categ... |
### Question:
Category { public Category id(Long id) { this.id = id; return this; } Category id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); Category name(String name); @javax... |
### Question:
Category { public Category name(String name) { this.name = name; return this; } Category id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); Category name(String nam... |
### Question:
ModelApiResponse { public ModelApiResponse code(Integer code) { this.code = code; return this; } ModelApiResponse code(Integer code); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_CODE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Integer getCode(); void s... |
### Question:
ModelApiResponse { public ModelApiResponse type(String type) { this.type = type; return this; } ModelApiResponse code(Integer code); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_CODE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Integer getCode(); void se... |
### Question:
ModelApiResponse { public ModelApiResponse message(String message) { this.message = message; return this; } ModelApiResponse code(Integer code); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_CODE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Integer getCod... |
### Question:
Tag { public Tag id(Long id) { this.id = id; return this; } Tag id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); Tag name(String name); @javax.annotation.Nullable... |
### Question:
Tag { public Tag name(String name) { this.name = name; return this; } Tag id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); Tag name(String name); @javax.annotatio... |
### Question:
UserApi { public void createUser(User body) throws RestClientException { createUserWithHttpInfo(body); } UserApi(); @Autowired UserApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void createUser(User body); ResponseEntity<Void> createUserWithHttpInfo(User body)... |
### Question:
UserApi { public void createUsersWithArrayInput(List<User> body) throws RestClientException { createUsersWithArrayInputWithHttpInfo(body); } UserApi(); @Autowired UserApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void createUser(User body); ResponseEntity<Voi... |
### Question:
UserApi { public void createUsersWithListInput(List<User> body) throws RestClientException { createUsersWithListInputWithHttpInfo(body); } UserApi(); @Autowired UserApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void createUser(User body); ResponseEntity<Void>... |
### Question:
UserApi { public void deleteUser(String username) throws RestClientException { deleteUserWithHttpInfo(username); } UserApi(); @Autowired UserApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void createUser(User body); ResponseEntity<Void> createUserWithHttpInfo(... |
### Question:
UserApi { public User getUserByName(String username) throws RestClientException { return getUserByNameWithHttpInfo(username).getBody(); } UserApi(); @Autowired UserApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void createUser(User body); ResponseEntity<Void> ... |
### Question:
UserApi { public String loginUser(String username, String password) throws RestClientException { return loginUserWithHttpInfo(username, password).getBody(); } UserApi(); @Autowired UserApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void createUser(User body); ... |
### Question:
UserApi { public void logoutUser() throws RestClientException { logoutUserWithHttpInfo(); } UserApi(); @Autowired UserApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void createUser(User body); ResponseEntity<Void> createUserWithHttpInfo(User body); void create... |
### Question:
UserApi { public void updateUser(String username, User body) throws RestClientException { updateUserWithHttpInfo(username, body); } UserApi(); @Autowired UserApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void createUser(User body); ResponseEntity<Void> create... |
### Question:
StoreApi { public void deleteOrder(Long orderId) throws RestClientException { deleteOrderWithHttpInfo(orderId); } StoreApi(); @Autowired StoreApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void deleteOrder(Long orderId); ResponseEntity<Void> deleteOrderWithHtt... |
### Question:
StoreApi { public Map<String, Integer> getInventory() throws RestClientException { return getInventoryWithHttpInfo().getBody(); } StoreApi(); @Autowired StoreApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void deleteOrder(Long orderId); ResponseEntity<Void> de... |
### Question:
StoreApi { public Order getOrderById(Long orderId) throws RestClientException { return getOrderByIdWithHttpInfo(orderId).getBody(); } StoreApi(); @Autowired StoreApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void deleteOrder(Long orderId); ResponseEntity<Void... |
### Question:
StoreApi { public Order placeOrder(Order body) throws RestClientException { return placeOrderWithHttpInfo(body).getBody(); } StoreApi(); @Autowired StoreApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void deleteOrder(Long orderId); ResponseEntity<Void> deleteO... |
### Question:
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 ... |
### Question:
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... |
### Question:
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<V... |
### Question:
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); ResponseEnti... |
### Question:
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 ... |
### Question:
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... |
### Question:
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); Resp... |
### Question:
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 ap... |
### Question:
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(); }### Answer:
@Test public void testFormatter() { String dateRegex1 = "^((19|20)\\d\\d)-(... |
### Question:
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[]) en... |
### Question:
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 UndertowSe... |
### Question:
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(); }### Answ... |
### Question:
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.... |
### Question:
OAuth2AuthenticationService { public void logout(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) { cookieHelper.clearCookies(httpServletRequest, httpServletResponse); } OAuth2AuthenticationService(OAuth2TokenEndpointClient authorizationClient, OAuth2CookieHelper cookieHelpe... |
### Question:
OAuth2AuthenticationService { public HttpServletRequest stripTokens(HttpServletRequest httpServletRequest) { Cookie[] cookies = cookieHelper.stripCookies(httpServletRequest.getCookies()); return new CookiesHttpServletRequestWrapper(httpServletRequest, cookies); } OAuth2AuthenticationService(OAuth2TokenEnd... |
### Question:
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 ... |
### Question:
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 contai... |
### Question:
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); CookieColl... |
### Question:
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(); @Ove... |
### Question:
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 boolea... |
### Question:
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); @O... |
### Question:
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... |
### Question:
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(O... |
### Question:
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(); Cookie... |
### Question:
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> cooki... |
### Question:
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(Collect... |
### Question:
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<? ext... |
### Question:
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... |
### Question:
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); ... |
### Question:
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[]) en... |
### Question:
ProjectValidator implements Validator { @Override public boolean supports(Class<?> clazz) { return Project.class.equals(clazz); } @Autowired ProjectValidator(ProjectRepository projectRepository,
QualityProfileRepository profileRepository,
SonarConnectionSettingsValid... |
### Question:
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); }### Answer:
@Test public void shouldSupportCodeChang... |
### Question:
ProjectConnectionsValidator implements Validator { @Override public boolean supports(Class<?> clazz) { return Project.class.equals(clazz); } @Autowired ProjectConnectionsValidator(ProjectValidator projectValidator,
SonarConnectionCheckerService sonarConnectionCheckerService,... |
### Question:
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())) { e... |
### Question:
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); }### Answer:
@Test public void shouldSupportScm... |
### Question:
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... |
### Question:
ProfitCalculator { public double calculateProfit(QualityViolation violation) { double nonRemediationCosts = violation.getNonRemediationCosts() * (violation.getArtefact().hasManualEstimate() ? violation.getArtefact().getManualEstimate() / 100.0 : violation.getArtefact().getChangeProbability()); return viol... |
### Question:
WeightedProfitCalculator { public double calculateWeightedProfit(QualityViolation violation) { return profitCalculator.calculateProfit(violation) / violation.getWeightingMetricValue(); } @Autowired WeightedProfitCalculator(ProfitCalculator profitCalculator); double calculateWeightedProfit(QualityViolatio... |
### Question:
CommitBasedCodeChangeProbabilityCalculator implements CodeChangeProbabilityCalculator { @Override public double calculateCodeChangeProbability(ScmConnectionSettings connectionSettings, String file) throws CodeChurnCalculationException, ScmConnectionEncodingException { log.info("Calculate code change proba... |
### Question:
CodeChurnCalculatorFactory { public CodeChurnCalculator create(ScmConnectionSettings connectionSettings) { if (connectionSettings.getType() == SupportedScmSystem.SVN.getType()) { return svnCodeChurnCalculator; } throw new UnsupportedScmSystem(); } @Autowired CodeChurnCalculatorFactory(SvnCodeChurnCalcula... |
### Question:
SvnServerAvailabilityCheckerService implements ScmAvailabilityCheckerService { @Override public boolean isAvailable(ScmConnectionSettings connectionSettings) { if (connectionSettings == null || Strings.isNullOrEmpty(connectionSettings.getUrl())) { return false; } try { SvnRepositoryFactory.create(connecti... |
### Question:
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; boolea... |
### Question:
SvnFile { int countLines() { if (content.isEmpty()) { return 0; } return content.split(lineSeparator).length; } SvnFile(String content, String lineSeparator); }### Answer:
@Test public void countLinesWithSuppliedSeparator() { assertThat(new SvnFile("1a2a3", "a").countLines()).isEqualTo(3); }
@Test publi... |
### Question:
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(otherProjectInformatio... |
### Question:
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 re... |
### Question:
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 co... |
### Question:
SonarConnectionCheckerService { public boolean isReachable(SonarConnectionSettings connectionSettings) { if (connectionSettings == null || Strings.isNullOrEmpty(connectionSettings.getUrl())) { return false; } HttpClient4Connector connector = new HttpClient4Connector(connectionSettings.asHostObject()); try... |
### Question:
CodeChangeProbabilityCalculatorFactory { CodeChangeProbabilityCalculator create(CodeChangeSettings codeChangeSettings) { if (codeChangeSettings.getMethod() == SupportedCodeChangeProbabilityMethod.WEIGHTED.getId()) { return new WeightedCodeChangeProbabilityCalculator(codeChurnCalculatorFactory, LocalDate.n... |
### Question:
SecureChangeProbabilityCalculator { public double calculateSecureChangeProbability(QualityProfile qualityProfile, SonarConnectionSettings sonarConnectionSettings, Artefact artefact) throws ResourceNotFoundException { log.info("Calculate secure change probability for artefact {}", artefact.getName()); doub... |
### Question:
AnalyzerRunnable implements Runnable { @Override public void run() { Project project = projectRepository.findOne(projectId); if (project != null) { project.setHadAnalysis(true); projectRepository.save(project); log.info("Start analyzer run for project {}", project.getName()); qualityAnalyzerService.analyz... |
### Question:
DefaultQualityAnalyzerScheduler implements QualityAnalyzerScheduler { public boolean scheduleAnalyzer(Project project) { if (alreadyScheduledProjects.contains(project)) { log.info("Project {} is already scheduled!", project.getName()); return false; } alreadyScheduledProjects.add(project); QualityAnalyzer... |
### Question:
DefaultQualityAnalyzerScheduler implements QualityAnalyzerScheduler { public void executeAnalyzer(Project project) { project.setHadAnalysis(true); projectRepository.save(project); QualityAnalyzerService qualityAnalyzerService = createDefaultQualityAnalyzer(); scheduler.execute(new AnalyzerRunnable(project... |
### Question:
QualityViolationCostsCalculator { public int calculateRemediationCosts(SonarConnectionSettings sonarConnectionSettings, ViolationOccurence violation) throws ResourceNotFoundException { log.info("Calculating remediation costs for {} with violated criteria {}", violation.getArtefact().getName(), violation.g... |
### Question:
QualityViolationCostsCalculator { public int calculateNonRemediationCosts(SonarConnectionSettings sonarConnectionSettings, ViolationOccurence violation) throws ResourceNotFoundException { log.info("Calculating non-remediation costs for {} with violated criteria {}", violation.getArtefact().getName(), viol... |
### Question:
Artefact implements Serializable { public String getFilename() { if (name.isEmpty()) { return ""; } return name.replace('.', '/') + ".java"; } protected Artefact(); Artefact(String name, String sonarIdentifier); String getFilename(); String getShortClassName(); boolean hasManualEstimate(); }### Answer:... |
### Question:
Artefact implements Serializable { public String getShortClassName() { String className = null; for (String packageName : Splitter.on('.').split(name)) { className = packageName; } return className; } protected Artefact(); Artefact(String name, String sonarIdentifier); String getFilename(); String getSh... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.