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 failedAnalysisWhenScmSystemIsNotAvailable() { ScmAvailabilityCheckerService notAvailableScmSystem = mock(ScmAvailabilityCheckerService.class); when(notAvailableScmSystem.isAvailable(any(ScmConnectionSettings.class))).thenReturn(false); ScmAvailabilityCheckerServiceFactory notAvailableCheckerServiceFac...
@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 failedAnalysisWhenProblemWithCodeChurnCalculationOccurred() throws CodeChurnCalculationException, ScmConnectionEncodingException { QualityAnalyzerService qualityAnalyzerService = createMockedSystemThatThrowsExceptionInCodeChangeCalculation(CodeChurnCalculationException.class); QualityAnalysis analysis...
@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 failedAnalysisWhenProblemWithScmConnectionEncodingOccurred() throws CodeChurnCalculationException, ScmConnectionEncodingException { QualityAnalyzerService qualityAnalyzerService = createMockedSystemThatThrowsExceptionInCodeChangeCalculation(ScmConnectionEncodingException.class); QualityAnalysis analys...
@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 failedAnalysisWhenCostCalculatorThrowsResourceNotFoundExceptionOnRemediationCosts() throws CodeChurnCalculationException, ScmConnectionEncodingException, ResourceNotFoundException { ViolationsCalculatorService violationsCalculatorService = mock(ViolationsCalculatorService.class); when(violationsCalcul...
@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 failedAnalysisWhenCostCalculatorThrowsResourceNotFoundExceptionOnNonRemediationCosts() throws CodeChurnCalculationException, ScmConnectionEncodingException, ResourceNotFoundException { ViolationsCalculatorService violationsCalculatorService = mock(ViolationsCalculatorService.class); when(violationsCal...
@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 createCalculatorForDefaultSetting() { assertThat(codeChangeProbabilityCalculatorFactory.create(CodeChangeSettings.defaultSetting(0))) .isInstanceOf(DefaultCodeChangeProbabilityCalculator.class); }
CodeChangeProbabilityCalculator create(CodeChangeSettings codeChangeSettings) { if (codeChangeSettings.getMethod() == SupportedCodeChangeProbabilityMethod.WEIGHTED.getId()) { return new WeightedCodeChangeProbabilityCalculator(codeChurnCalculatorFactory, LocalDate.now(), codeChangeSettings.getDays()); } else if (codeCha...
CodeChangeProbabilityCalculatorFactory { CodeChangeProbabilityCalculator create(CodeChangeSettings codeChangeSettings) { if (codeChangeSettings.getMethod() == SupportedCodeChangeProbabilityMethod.WEIGHTED.getId()) { return new WeightedCodeChangeProbabilityCalculator(codeChurnCalculatorFactory, LocalDate.now(), codeChan...
CodeChangeProbabilityCalculatorFactory { CodeChangeProbabilityCalculator create(CodeChangeSettings codeChangeSettings) { if (codeChangeSettings.getMethod() == SupportedCodeChangeProbabilityMethod.WEIGHTED.getId()) { return new WeightedCodeChangeProbabilityCalculator(codeChurnCalculatorFactory, LocalDate.now(), codeChan...
CodeChangeProbabilityCalculatorFactory { CodeChangeProbabilityCalculator create(CodeChangeSettings codeChangeSettings) { if (codeChangeSettings.getMethod() == SupportedCodeChangeProbabilityMethod.WEIGHTED.getId()) { return new WeightedCodeChangeProbabilityCalculator(codeChurnCalculatorFactory, LocalDate.now(), codeChan...
CodeChangeProbabilityCalculatorFactory { CodeChangeProbabilityCalculator create(CodeChangeSettings codeChangeSettings) { if (codeChangeSettings.getMethod() == SupportedCodeChangeProbabilityMethod.WEIGHTED.getId()) { return new WeightedCodeChangeProbabilityCalculator(codeChurnCalculatorFactory, LocalDate.now(), codeChan...
@Test public void createCalculatorWithCorrectNumberOfDaysForDefaultSetting() { assertThat(((DefaultCodeChangeProbabilityCalculator) codeChangeProbabilityCalculatorFactory.create(CodeChangeSettings.defaultSetting(30))).getDays()) .isEqualTo(30); }
CodeChangeProbabilityCalculator create(CodeChangeSettings codeChangeSettings) { if (codeChangeSettings.getMethod() == SupportedCodeChangeProbabilityMethod.WEIGHTED.getId()) { return new WeightedCodeChangeProbabilityCalculator(codeChurnCalculatorFactory, LocalDate.now(), codeChangeSettings.getDays()); } else if (codeCha...
CodeChangeProbabilityCalculatorFactory { CodeChangeProbabilityCalculator create(CodeChangeSettings codeChangeSettings) { if (codeChangeSettings.getMethod() == SupportedCodeChangeProbabilityMethod.WEIGHTED.getId()) { return new WeightedCodeChangeProbabilityCalculator(codeChurnCalculatorFactory, LocalDate.now(), codeChan...
CodeChangeProbabilityCalculatorFactory { CodeChangeProbabilityCalculator create(CodeChangeSettings codeChangeSettings) { if (codeChangeSettings.getMethod() == SupportedCodeChangeProbabilityMethod.WEIGHTED.getId()) { return new WeightedCodeChangeProbabilityCalculator(codeChurnCalculatorFactory, LocalDate.now(), codeChan...
CodeChangeProbabilityCalculatorFactory { CodeChangeProbabilityCalculator create(CodeChangeSettings codeChangeSettings) { if (codeChangeSettings.getMethod() == SupportedCodeChangeProbabilityMethod.WEIGHTED.getId()) { return new WeightedCodeChangeProbabilityCalculator(codeChurnCalculatorFactory, LocalDate.now(), codeChan...
CodeChangeProbabilityCalculatorFactory { CodeChangeProbabilityCalculator create(CodeChangeSettings codeChangeSettings) { if (codeChangeSettings.getMethod() == SupportedCodeChangeProbabilityMethod.WEIGHTED.getId()) { return new WeightedCodeChangeProbabilityCalculator(codeChurnCalculatorFactory, LocalDate.now(), codeChan...
@Test public void createCalculatorForWeightedSetting() { assertThat(codeChangeProbabilityCalculatorFactory.create(CodeChangeSettings.weightedSetting(0))) .isInstanceOf(WeightedCodeChangeProbabilityCalculator.class); }
CodeChangeProbabilityCalculator create(CodeChangeSettings codeChangeSettings) { if (codeChangeSettings.getMethod() == SupportedCodeChangeProbabilityMethod.WEIGHTED.getId()) { return new WeightedCodeChangeProbabilityCalculator(codeChurnCalculatorFactory, LocalDate.now(), codeChangeSettings.getDays()); } else if (codeCha...
CodeChangeProbabilityCalculatorFactory { CodeChangeProbabilityCalculator create(CodeChangeSettings codeChangeSettings) { if (codeChangeSettings.getMethod() == SupportedCodeChangeProbabilityMethod.WEIGHTED.getId()) { return new WeightedCodeChangeProbabilityCalculator(codeChurnCalculatorFactory, LocalDate.now(), codeChan...
CodeChangeProbabilityCalculatorFactory { CodeChangeProbabilityCalculator create(CodeChangeSettings codeChangeSettings) { if (codeChangeSettings.getMethod() == SupportedCodeChangeProbabilityMethod.WEIGHTED.getId()) { return new WeightedCodeChangeProbabilityCalculator(codeChurnCalculatorFactory, LocalDate.now(), codeChan...
CodeChangeProbabilityCalculatorFactory { CodeChangeProbabilityCalculator create(CodeChangeSettings codeChangeSettings) { if (codeChangeSettings.getMethod() == SupportedCodeChangeProbabilityMethod.WEIGHTED.getId()) { return new WeightedCodeChangeProbabilityCalculator(codeChurnCalculatorFactory, LocalDate.now(), codeChan...
CodeChangeProbabilityCalculatorFactory { CodeChangeProbabilityCalculator create(CodeChangeSettings codeChangeSettings) { if (codeChangeSettings.getMethod() == SupportedCodeChangeProbabilityMethod.WEIGHTED.getId()) { return new WeightedCodeChangeProbabilityCalculator(codeChurnCalculatorFactory, LocalDate.now(), codeChan...
@Test public void containsAllQualityViolationsSortedByProfitAndRemediationCosts() { QualityInvestmentPlan qualityInvestmentPlan = investmentPlanService.computeInvestmentPlan(analysis, "", 80); QualityInvestmentPlanEntry[] investments = qualityInvestmentPlan.getEntries().toArray(new QualityInvestmentPlanEntry[0]); asser...
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 createCalculatorWithCorrectNumberOfDaysForWeightedSetting() { assertThat(((WeightedCodeChangeProbabilityCalculator) codeChangeProbabilityCalculatorFactory.create(CodeChangeSettings.weightedSetting(30))).getDays()) .isEqualTo(30); }
CodeChangeProbabilityCalculator create(CodeChangeSettings codeChangeSettings) { if (codeChangeSettings.getMethod() == SupportedCodeChangeProbabilityMethod.WEIGHTED.getId()) { return new WeightedCodeChangeProbabilityCalculator(codeChurnCalculatorFactory, LocalDate.now(), codeChangeSettings.getDays()); } else if (codeCha...
CodeChangeProbabilityCalculatorFactory { CodeChangeProbabilityCalculator create(CodeChangeSettings codeChangeSettings) { if (codeChangeSettings.getMethod() == SupportedCodeChangeProbabilityMethod.WEIGHTED.getId()) { return new WeightedCodeChangeProbabilityCalculator(codeChurnCalculatorFactory, LocalDate.now(), codeChan...
CodeChangeProbabilityCalculatorFactory { CodeChangeProbabilityCalculator create(CodeChangeSettings codeChangeSettings) { if (codeChangeSettings.getMethod() == SupportedCodeChangeProbabilityMethod.WEIGHTED.getId()) { return new WeightedCodeChangeProbabilityCalculator(codeChurnCalculatorFactory, LocalDate.now(), codeChan...
CodeChangeProbabilityCalculatorFactory { CodeChangeProbabilityCalculator create(CodeChangeSettings codeChangeSettings) { if (codeChangeSettings.getMethod() == SupportedCodeChangeProbabilityMethod.WEIGHTED.getId()) { return new WeightedCodeChangeProbabilityCalculator(codeChurnCalculatorFactory, LocalDate.now(), codeChan...
CodeChangeProbabilityCalculatorFactory { CodeChangeProbabilityCalculator create(CodeChangeSettings codeChangeSettings) { if (codeChangeSettings.getMethod() == SupportedCodeChangeProbabilityMethod.WEIGHTED.getId()) { return new WeightedCodeChangeProbabilityCalculator(codeChurnCalculatorFactory, LocalDate.now(), codeChan...
@Test public void profileWithNoChangeRiskAssessmentFunctions() throws ResourceNotFoundException { assertThat(secureChangeProbabilityCalculator.calculateSecureChangeProbability( profile, mock(SonarConnectionSettings.class), mock(Artefact.class))).isEqualTo(1.0); }
public double calculateSecureChangeProbability(QualityProfile qualityProfile, SonarConnectionSettings sonarConnectionSettings, Artefact artefact) throws ResourceNotFoundException { log.info("Calculate secure change probability for artefact {}", artefact.getName()); double secureChangeProbability = 1.0; for (ChangeRiskA...
SecureChangeProbabilityCalculator { public double calculateSecureChangeProbability(QualityProfile qualityProfile, SonarConnectionSettings sonarConnectionSettings, Artefact artefact) throws ResourceNotFoundException { log.info("Calculate secure change probability for artefact {}", artefact.getName()); double secureChang...
SecureChangeProbabilityCalculator { public double calculateSecureChangeProbability(QualityProfile qualityProfile, SonarConnectionSettings sonarConnectionSettings, Artefact artefact) throws ResourceNotFoundException { log.info("Calculate secure change probability for artefact {}", artefact.getName()); double secureChang...
SecureChangeProbabilityCalculator { public double calculateSecureChangeProbability(QualityProfile qualityProfile, SonarConnectionSettings sonarConnectionSettings, Artefact artefact) throws ResourceNotFoundException { log.info("Calculate secure change probability for artefact {}", artefact.getName()); double secureChang...
SecureChangeProbabilityCalculator { public double calculateSecureChangeProbability(QualityProfile qualityProfile, SonarConnectionSettings sonarConnectionSettings, Artefact artefact) throws ResourceNotFoundException { log.info("Calculate secure change probability for artefact {}", artefact.getName()); double secureChang...
@Test public void profileWithOneChangeRiskAssessmentFunction() throws ResourceNotFoundException { metricCollectorService.addMetricValue("A", "metric", 9.0); profile.addChangeRiskAssessmentFunction(new ChangeRiskAssessmentFunction(profile, "metric", Sets.newHashSet(new RiskCharge(0.2, "<", 10.0)))); assertThat(secureCha...
public double calculateSecureChangeProbability(QualityProfile qualityProfile, SonarConnectionSettings sonarConnectionSettings, Artefact artefact) throws ResourceNotFoundException { log.info("Calculate secure change probability for artefact {}", artefact.getName()); double secureChangeProbability = 1.0; for (ChangeRiskA...
SecureChangeProbabilityCalculator { public double calculateSecureChangeProbability(QualityProfile qualityProfile, SonarConnectionSettings sonarConnectionSettings, Artefact artefact) throws ResourceNotFoundException { log.info("Calculate secure change probability for artefact {}", artefact.getName()); double secureChang...
SecureChangeProbabilityCalculator { public double calculateSecureChangeProbability(QualityProfile qualityProfile, SonarConnectionSettings sonarConnectionSettings, Artefact artefact) throws ResourceNotFoundException { log.info("Calculate secure change probability for artefact {}", artefact.getName()); double secureChang...
SecureChangeProbabilityCalculator { public double calculateSecureChangeProbability(QualityProfile qualityProfile, SonarConnectionSettings sonarConnectionSettings, Artefact artefact) throws ResourceNotFoundException { log.info("Calculate secure change probability for artefact {}", artefact.getName()); double secureChang...
SecureChangeProbabilityCalculator { public double calculateSecureChangeProbability(QualityProfile qualityProfile, SonarConnectionSettings sonarConnectionSettings, Artefact artefact) throws ResourceNotFoundException { log.info("Calculate secure change probability for artefact {}", artefact.getName()); double secureChang...
@Test public void profileWithManyChangeRiskAssessmentFunctions() throws ResourceNotFoundException { metricCollectorService.addMetricValue("A", "metric1", 9.0); metricCollectorService.addMetricValue("A", "metric2", -1.0); metricCollectorService.addMetricValue("A", "metric3", 0.0); profile.addChangeRiskAssessmentFunction...
public double calculateSecureChangeProbability(QualityProfile qualityProfile, SonarConnectionSettings sonarConnectionSettings, Artefact artefact) throws ResourceNotFoundException { log.info("Calculate secure change probability for artefact {}", artefact.getName()); double secureChangeProbability = 1.0; for (ChangeRiskA...
SecureChangeProbabilityCalculator { public double calculateSecureChangeProbability(QualityProfile qualityProfile, SonarConnectionSettings sonarConnectionSettings, Artefact artefact) throws ResourceNotFoundException { log.info("Calculate secure change probability for artefact {}", artefact.getName()); double secureChang...
SecureChangeProbabilityCalculator { public double calculateSecureChangeProbability(QualityProfile qualityProfile, SonarConnectionSettings sonarConnectionSettings, Artefact artefact) throws ResourceNotFoundException { log.info("Calculate secure change probability for artefact {}", artefact.getName()); double secureChang...
SecureChangeProbabilityCalculator { public double calculateSecureChangeProbability(QualityProfile qualityProfile, SonarConnectionSettings sonarConnectionSettings, Artefact artefact) throws ResourceNotFoundException { log.info("Calculate secure change probability for artefact {}", artefact.getName()); double secureChang...
SecureChangeProbabilityCalculator { public double calculateSecureChangeProbability(QualityProfile qualityProfile, SonarConnectionSettings sonarConnectionSettings, Artefact artefact) throws ResourceNotFoundException { log.info("Calculate secure change probability for artefact {}", artefact.getName()); double secureChang...
@Test public void retrieveProjectWithRepositoryFromDatabaseAndTriggerAnalysisAfterwards() { analyzerRunnable.run(); InOrder inOrder = inOrder(projectRepository, analyzerService); inOrder.verify(projectRepository).findOne(1L); inOrder.verify(analyzerService).analyzeProject(project); inOrder.verifyNoMoreInteractions(); }
@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.analyzeProject(project); log.info("Finished analyzer run fo...
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.analyzeProject(proje...
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.analyzeProject(proje...
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.analyzeProject(proje...
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.analyzeProject(proje...
@Test public void markProjectAsHadAnalysis() { analyzerRunnable.run(); verify(project).setHadAnalysis(true); }
@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.analyzeProject(project); log.info("Finished analyzer run fo...
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.analyzeProject(proje...
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.analyzeProject(proje...
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.analyzeProject(proje...
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.analyzeProject(proje...
@Test public void executedProjectShouldBeSavedToDatabaseAfterMarkedAsHadAnalysis() { analyzerRunnable.run(); InOrder inOrder = inOrder(project, projectRepository); inOrder.verify(project).setHadAnalysis(true); inOrder.verify(projectRepository).save(project); }
@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.analyzeProject(project); log.info("Finished analyzer run fo...
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.analyzeProject(proje...
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.analyzeProject(proje...
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.analyzeProject(proje...
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.analyzeProject(proje...
@Test public void notFailWhenProjectIsNotRetrievableViaRepository() { when(projectRepository.findOne(1L)).thenReturn(null); analyzerRunnable.run(); }
@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.analyzeProject(project); log.info("Finished analyzer run fo...
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.analyzeProject(proje...
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.analyzeProject(proje...
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.analyzeProject(proje...
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.analyzeProject(proje...
@Test public void failedViolationAnalysisResultWhenSonarProjectIsNotReachable() { SonarConnectionSettings connectionSettings = new SonarConnectionSettings(defaultSonarHost, "abc"); Project project = mock(Project.class); when(project.getSonarConnectionSettings()).thenReturn(connectionSettings); SonarConnectionCheckerSer...
ViolationsAnalysisResult calculateAllViolation(Project project) { if (!sonarConnectionCheckerService.isReachable(project.getSonarConnectionSettings())) { return ViolationsAnalysisResult.createFailedAnalysis(Collections.<ViolationOccurence>emptyList(), "sonar project is not reachable with supplied connection settings: "...
ViolationsCalculatorService { ViolationsAnalysisResult calculateAllViolation(Project project) { if (!sonarConnectionCheckerService.isReachable(project.getSonarConnectionSettings())) { return ViolationsAnalysisResult.createFailedAnalysis(Collections.<ViolationOccurence>emptyList(), "sonar project is not reachable with s...
ViolationsCalculatorService { ViolationsAnalysisResult calculateAllViolation(Project project) { if (!sonarConnectionCheckerService.isReachable(project.getSonarConnectionSettings())) { return ViolationsAnalysisResult.createFailedAnalysis(Collections.<ViolationOccurence>emptyList(), "sonar project is not reachable with s...
ViolationsCalculatorService { ViolationsAnalysisResult calculateAllViolation(Project project) { if (!sonarConnectionCheckerService.isReachable(project.getSonarConnectionSettings())) { return ViolationsAnalysisResult.createFailedAnalysis(Collections.<ViolationOccurence>emptyList(), "sonar project is not reachable with s...
ViolationsCalculatorService { ViolationsAnalysisResult calculateAllViolation(Project project) { if (!sonarConnectionCheckerService.isReachable(project.getSonarConnectionSettings())) { return ViolationsAnalysisResult.createFailedAnalysis(Collections.<ViolationOccurence>emptyList(), "sonar project is not reachable with s...
@Test public void failedViolationAnalysisResultWhenOneMetricValueIsNotReachable() throws ResourceNotFoundException { Resource dummyResource = new Resource(); ResourcesCollectorService resourcesCollectorService = mock(ResourcesCollectorService.class); when(resourcesCollectorService.collectAllResourcesForProject(any(Sona...
ViolationsAnalysisResult calculateAllViolation(Project project) { if (!sonarConnectionCheckerService.isReachable(project.getSonarConnectionSettings())) { return ViolationsAnalysisResult.createFailedAnalysis(Collections.<ViolationOccurence>emptyList(), "sonar project is not reachable with supplied connection settings: "...
ViolationsCalculatorService { ViolationsAnalysisResult calculateAllViolation(Project project) { if (!sonarConnectionCheckerService.isReachable(project.getSonarConnectionSettings())) { return ViolationsAnalysisResult.createFailedAnalysis(Collections.<ViolationOccurence>emptyList(), "sonar project is not reachable with s...
ViolationsCalculatorService { ViolationsAnalysisResult calculateAllViolation(Project project) { if (!sonarConnectionCheckerService.isReachable(project.getSonarConnectionSettings())) { return ViolationsAnalysisResult.createFailedAnalysis(Collections.<ViolationOccurence>emptyList(), "sonar project is not reachable with s...
ViolationsCalculatorService { ViolationsAnalysisResult calculateAllViolation(Project project) { if (!sonarConnectionCheckerService.isReachable(project.getSonarConnectionSettings())) { return ViolationsAnalysisResult.createFailedAnalysis(Collections.<ViolationOccurence>emptyList(), "sonar project is not reachable with s...
ViolationsCalculatorService { ViolationsAnalysisResult calculateAllViolation(Project project) { if (!sonarConnectionCheckerService.isReachable(project.getSonarConnectionSettings())) { return ViolationsAnalysisResult.createFailedAnalysis(Collections.<ViolationOccurence>emptyList(), "sonar project is not reachable with s...
@Test public void shouldOnlyConsiderArtefactThatStartWithBasePackageName() { QualityInvestmentPlan qualityInvestmentPlan = investmentPlanService.computeInvestmentPlan(analysis, "org.project", 80); assertThat(qualityInvestmentPlan.getEntries()).hasSize(1); assertThat(qualityInvestmentPlan.getEntries().iterator().next()....
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 noViolationsWhenNoRequirementsAreViolated() { FakeResourcesCollectorService resourcesCollectorService = new FakeResourcesCollectorService(); resourcesCollectorService.addResource("A"); resourcesCollectorService.addResource("B"); FakeMetricCollectorService metricCollectorService = new FakeMetricCollect...
ViolationsAnalysisResult calculateAllViolation(Project project) { if (!sonarConnectionCheckerService.isReachable(project.getSonarConnectionSettings())) { return ViolationsAnalysisResult.createFailedAnalysis(Collections.<ViolationOccurence>emptyList(), "sonar project is not reachable with supplied connection settings: "...
ViolationsCalculatorService { ViolationsAnalysisResult calculateAllViolation(Project project) { if (!sonarConnectionCheckerService.isReachable(project.getSonarConnectionSettings())) { return ViolationsAnalysisResult.createFailedAnalysis(Collections.<ViolationOccurence>emptyList(), "sonar project is not reachable with s...
ViolationsCalculatorService { ViolationsAnalysisResult calculateAllViolation(Project project) { if (!sonarConnectionCheckerService.isReachable(project.getSonarConnectionSettings())) { return ViolationsAnalysisResult.createFailedAnalysis(Collections.<ViolationOccurence>emptyList(), "sonar project is not reachable with s...
ViolationsCalculatorService { ViolationsAnalysisResult calculateAllViolation(Project project) { if (!sonarConnectionCheckerService.isReachable(project.getSonarConnectionSettings())) { return ViolationsAnalysisResult.createFailedAnalysis(Collections.<ViolationOccurence>emptyList(), "sonar project is not reachable with s...
ViolationsCalculatorService { ViolationsAnalysisResult calculateAllViolation(Project project) { if (!sonarConnectionCheckerService.isReachable(project.getSonarConnectionSettings())) { return ViolationsAnalysisResult.createFailedAnalysis(Collections.<ViolationOccurence>emptyList(), "sonar project is not reachable with s...
@Test public void violationsWhenRequirementsAreViolatedInOneArtefact() { FakeResourcesCollectorService resourcesCollectorService = new FakeResourcesCollectorService(); resourcesCollectorService.addResource("A"); resourcesCollectorService.addResource("B"); FakeMetricCollectorService metricCollectorService = new FakeMetr...
ViolationsAnalysisResult calculateAllViolation(Project project) { if (!sonarConnectionCheckerService.isReachable(project.getSonarConnectionSettings())) { return ViolationsAnalysisResult.createFailedAnalysis(Collections.<ViolationOccurence>emptyList(), "sonar project is not reachable with supplied connection settings: "...
ViolationsCalculatorService { ViolationsAnalysisResult calculateAllViolation(Project project) { if (!sonarConnectionCheckerService.isReachable(project.getSonarConnectionSettings())) { return ViolationsAnalysisResult.createFailedAnalysis(Collections.<ViolationOccurence>emptyList(), "sonar project is not reachable with s...
ViolationsCalculatorService { ViolationsAnalysisResult calculateAllViolation(Project project) { if (!sonarConnectionCheckerService.isReachable(project.getSonarConnectionSettings())) { return ViolationsAnalysisResult.createFailedAnalysis(Collections.<ViolationOccurence>emptyList(), "sonar project is not reachable with s...
ViolationsCalculatorService { ViolationsAnalysisResult calculateAllViolation(Project project) { if (!sonarConnectionCheckerService.isReachable(project.getSonarConnectionSettings())) { return ViolationsAnalysisResult.createFailedAnalysis(Collections.<ViolationOccurence>emptyList(), "sonar project is not reachable with s...
ViolationsCalculatorService { ViolationsAnalysisResult calculateAllViolation(Project project) { if (!sonarConnectionCheckerService.isReachable(project.getSonarConnectionSettings())) { return ViolationsAnalysisResult.createFailedAnalysis(Collections.<ViolationOccurence>emptyList(), "sonar project is not reachable with s...
@Test public void violationsWhenRequirementsAreViolatedInManyArtefact() { FakeResourcesCollectorService resourcesCollectorService = new FakeResourcesCollectorService(); resourcesCollectorService.addResource("A"); resourcesCollectorService.addResource("B"); resourcesCollectorService.addResource("C"); FakeMetricCollector...
ViolationsAnalysisResult calculateAllViolation(Project project) { if (!sonarConnectionCheckerService.isReachable(project.getSonarConnectionSettings())) { return ViolationsAnalysisResult.createFailedAnalysis(Collections.<ViolationOccurence>emptyList(), "sonar project is not reachable with supplied connection settings: "...
ViolationsCalculatorService { ViolationsAnalysisResult calculateAllViolation(Project project) { if (!sonarConnectionCheckerService.isReachable(project.getSonarConnectionSettings())) { return ViolationsAnalysisResult.createFailedAnalysis(Collections.<ViolationOccurence>emptyList(), "sonar project is not reachable with s...
ViolationsCalculatorService { ViolationsAnalysisResult calculateAllViolation(Project project) { if (!sonarConnectionCheckerService.isReachable(project.getSonarConnectionSettings())) { return ViolationsAnalysisResult.createFailedAnalysis(Collections.<ViolationOccurence>emptyList(), "sonar project is not reachable with s...
ViolationsCalculatorService { ViolationsAnalysisResult calculateAllViolation(Project project) { if (!sonarConnectionCheckerService.isReachable(project.getSonarConnectionSettings())) { return ViolationsAnalysisResult.createFailedAnalysis(Collections.<ViolationOccurence>emptyList(), "sonar project is not reachable with s...
ViolationsCalculatorService { ViolationsAnalysisResult calculateAllViolation(Project project) { if (!sonarConnectionCheckerService.isReachable(project.getSonarConnectionSettings())) { return ViolationsAnalysisResult.createFailedAnalysis(Collections.<ViolationOccurence>emptyList(), "sonar project is not reachable with s...
@Test public void scheduleProjectForAnalysis() { assertThat(analyzerScheduler.scheduleAnalyzer(project)).isTrue(); }
public boolean scheduleAnalyzer(Project project) { if (alreadyScheduledProjects.contains(project)) { log.info("Project {} is already scheduled!", project.getName()); return false; } alreadyScheduledProjects.add(project); QualityAnalyzerService qualityAnalyzerService = createDefaultQualityAnalyzer(); scheduler.schedule(...
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); QualityAnalyzerService qualit...
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); QualityAnalyzerService qualit...
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); QualityAnalyzerService qualit...
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); QualityAnalyzerService qualit...
@Test public void failToScheduleProjectTwice() { analyzerScheduler.scheduleAnalyzer(project); assertThat(analyzerScheduler.scheduleAnalyzer(project)).isFalse(); }
public boolean scheduleAnalyzer(Project project) { if (alreadyScheduledProjects.contains(project)) { log.info("Project {} is already scheduled!", project.getName()); return false; } alreadyScheduledProjects.add(project); QualityAnalyzerService qualityAnalyzerService = createDefaultQualityAnalyzer(); scheduler.schedule(...
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); QualityAnalyzerService qualit...
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); QualityAnalyzerService qualit...
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); QualityAnalyzerService qualit...
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); QualityAnalyzerService qualit...
@Test public void executedProjectShouldBeMarkedAsHadAnalysis() { analyzerScheduler.executeAnalyzer(project); assertThat(project.hadAnalysis()).isTrue(); }
public void executeAnalyzer(Project project) { project.setHadAnalysis(true); projectRepository.save(project); QualityAnalyzerService qualityAnalyzerService = createDefaultQualityAnalyzer(); scheduler.execute(new AnalyzerRunnable(project, projectRepository, qualityAnalyzerService)); log.info("Executing analyzer job for ...
DefaultQualityAnalyzerScheduler implements QualityAnalyzerScheduler { public void executeAnalyzer(Project project) { project.setHadAnalysis(true); projectRepository.save(project); QualityAnalyzerService qualityAnalyzerService = createDefaultQualityAnalyzer(); scheduler.execute(new AnalyzerRunnable(project, projectRepos...
DefaultQualityAnalyzerScheduler implements QualityAnalyzerScheduler { public void executeAnalyzer(Project project) { project.setHadAnalysis(true); projectRepository.save(project); QualityAnalyzerService qualityAnalyzerService = createDefaultQualityAnalyzer(); scheduler.execute(new AnalyzerRunnable(project, projectRepos...
DefaultQualityAnalyzerScheduler implements QualityAnalyzerScheduler { public void executeAnalyzer(Project project) { project.setHadAnalysis(true); projectRepository.save(project); QualityAnalyzerService qualityAnalyzerService = createDefaultQualityAnalyzer(); scheduler.execute(new AnalyzerRunnable(project, projectRepos...
DefaultQualityAnalyzerScheduler implements QualityAnalyzerScheduler { public void executeAnalyzer(Project project) { project.setHadAnalysis(true); projectRepository.save(project); QualityAnalyzerService qualityAnalyzerService = createDefaultQualityAnalyzer(); scheduler.execute(new AnalyzerRunnable(project, projectRepos...
@Test public void scheduledProjectShouldNotBeMarkedAsHadAnalysis() { analyzerScheduler.scheduleAnalyzer(project); assertThat(project.hadAnalysis()).isFalse(); }
public boolean scheduleAnalyzer(Project project) { if (alreadyScheduledProjects.contains(project)) { log.info("Project {} is already scheduled!", project.getName()); return false; } alreadyScheduledProjects.add(project); QualityAnalyzerService qualityAnalyzerService = createDefaultQualityAnalyzer(); scheduler.schedule(...
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); QualityAnalyzerService qualit...
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); QualityAnalyzerService qualit...
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); QualityAnalyzerService qualit...
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); QualityAnalyzerService qualit...
@Test public void executedProjectShouldBeSavedToDatabaseAfterMarkedAsHadAnalysis() { analyzerScheduler.executeAnalyzer(project); InOrder inOrder = inOrder(project, projectRepository); inOrder.verify(project).setHadAnalysis(true); inOrder.verify(projectRepository).save(project); }
public void executeAnalyzer(Project project) { project.setHadAnalysis(true); projectRepository.save(project); QualityAnalyzerService qualityAnalyzerService = createDefaultQualityAnalyzer(); scheduler.execute(new AnalyzerRunnable(project, projectRepository, qualityAnalyzerService)); log.info("Executing analyzer job for ...
DefaultQualityAnalyzerScheduler implements QualityAnalyzerScheduler { public void executeAnalyzer(Project project) { project.setHadAnalysis(true); projectRepository.save(project); QualityAnalyzerService qualityAnalyzerService = createDefaultQualityAnalyzer(); scheduler.execute(new AnalyzerRunnable(project, projectRepos...
DefaultQualityAnalyzerScheduler implements QualityAnalyzerScheduler { public void executeAnalyzer(Project project) { project.setHadAnalysis(true); projectRepository.save(project); QualityAnalyzerService qualityAnalyzerService = createDefaultQualityAnalyzer(); scheduler.execute(new AnalyzerRunnable(project, projectRepos...
DefaultQualityAnalyzerScheduler implements QualityAnalyzerScheduler { public void executeAnalyzer(Project project) { project.setHadAnalysis(true); projectRepository.save(project); QualityAnalyzerService qualityAnalyzerService = createDefaultQualityAnalyzer(); scheduler.execute(new AnalyzerRunnable(project, projectRepos...
DefaultQualityAnalyzerScheduler implements QualityAnalyzerScheduler { public void executeAnalyzer(Project project) { project.setHadAnalysis(true); projectRepository.save(project); QualityAnalyzerService qualityAnalyzerService = createDefaultQualityAnalyzer(); scheduler.execute(new AnalyzerRunnable(project, projectRepos...
@Test public void calculateRemediationCostsProperlyForGreaterOperator() throws ResourceNotFoundException { QualityRequirement requirement = new QualityRequirement(qualityProfile, 20, 30, 100, "nloc", new QualityCriteria("metric", ">", 10.0)); ViolationOccurence violation = new ViolationOccurence(requirement, artefact, ...
public int calculateRemediationCosts(SonarConnectionSettings sonarConnectionSettings, ViolationOccurence violation) throws ResourceNotFoundException { log.info("Calculating remediation costs for {} with violated criteria {}", violation.getArtefact().getName(), violation.getRequirement().getCriteria()); return calculate...
QualityViolationCostsCalculator { public int calculateRemediationCosts(SonarConnectionSettings sonarConnectionSettings, ViolationOccurence violation) throws ResourceNotFoundException { log.info("Calculating remediation costs for {} with violated criteria {}", violation.getArtefact().getName(), violation.getRequirement(...
QualityViolationCostsCalculator { public int calculateRemediationCosts(SonarConnectionSettings sonarConnectionSettings, ViolationOccurence violation) throws ResourceNotFoundException { log.info("Calculating remediation costs for {} with violated criteria {}", violation.getArtefact().getName(), violation.getRequirement(...
QualityViolationCostsCalculator { public int calculateRemediationCosts(SonarConnectionSettings sonarConnectionSettings, ViolationOccurence violation) throws ResourceNotFoundException { log.info("Calculating remediation costs for {} with violated criteria {}", violation.getArtefact().getName(), violation.getRequirement(...
QualityViolationCostsCalculator { public int calculateRemediationCosts(SonarConnectionSettings sonarConnectionSettings, ViolationOccurence violation) throws ResourceNotFoundException { log.info("Calculating remediation costs for {} with violated criteria {}", violation.getArtefact().getName(), violation.getRequirement(...
@Test public void calculateRemediationCostsProperlyForLessOperator() throws ResourceNotFoundException { QualityRequirement requirement = new QualityRequirement(qualityProfile, 20, 30, 100, "nloc", new QualityCriteria("metric", "<", 1.0)); ViolationOccurence violation = new ViolationOccurence(requirement, artefact, 0); ...
public int calculateRemediationCosts(SonarConnectionSettings sonarConnectionSettings, ViolationOccurence violation) throws ResourceNotFoundException { log.info("Calculating remediation costs for {} with violated criteria {}", violation.getArtefact().getName(), violation.getRequirement().getCriteria()); return calculate...
QualityViolationCostsCalculator { public int calculateRemediationCosts(SonarConnectionSettings sonarConnectionSettings, ViolationOccurence violation) throws ResourceNotFoundException { log.info("Calculating remediation costs for {} with violated criteria {}", violation.getArtefact().getName(), violation.getRequirement(...
QualityViolationCostsCalculator { public int calculateRemediationCosts(SonarConnectionSettings sonarConnectionSettings, ViolationOccurence violation) throws ResourceNotFoundException { log.info("Calculating remediation costs for {} with violated criteria {}", violation.getArtefact().getName(), violation.getRequirement(...
QualityViolationCostsCalculator { public int calculateRemediationCosts(SonarConnectionSettings sonarConnectionSettings, ViolationOccurence violation) throws ResourceNotFoundException { log.info("Calculating remediation costs for {} with violated criteria {}", violation.getArtefact().getName(), violation.getRequirement(...
QualityViolationCostsCalculator { public int calculateRemediationCosts(SonarConnectionSettings sonarConnectionSettings, ViolationOccurence violation) throws ResourceNotFoundException { log.info("Calculating remediation costs for {} with violated criteria {}", violation.getArtefact().getName(), violation.getRequirement(...
@Test public void shouldChooseViolationsWithMoreProfit() { QualityViolation violation1 = new QualityViolation(new Artefact("org.A", ""), createRequirementOnlyWithCriteria(new QualityCriteria("cc", "<", 5.0)), 50, 0, 0.0, "ncloc"); QualityViolation violation2 = new QualityViolation(new Artefact("org.project.B", ""), cre...
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 calculateNonRemediationCostsProperlyForGreaterEqualsOperator() throws ResourceNotFoundException { QualityRequirement requirement = new QualityRequirement(qualityProfile, 20, 30, 100, "nloc", new QualityCriteria("metric", ">=", 5.0)); ViolationOccurence violation = new ViolationOccurence(requirement, a...
public int calculateNonRemediationCosts(SonarConnectionSettings sonarConnectionSettings, ViolationOccurence violation) throws ResourceNotFoundException { log.info("Calculating non-remediation costs for {} with violated criteria {}", violation.getArtefact().getName(), violation.getRequirement().getCriteria()); return ca...
QualityViolationCostsCalculator { public int calculateNonRemediationCosts(SonarConnectionSettings sonarConnectionSettings, ViolationOccurence violation) throws ResourceNotFoundException { log.info("Calculating non-remediation costs for {} with violated criteria {}", violation.getArtefact().getName(), violation.getRequi...
QualityViolationCostsCalculator { public int calculateNonRemediationCosts(SonarConnectionSettings sonarConnectionSettings, ViolationOccurence violation) throws ResourceNotFoundException { log.info("Calculating non-remediation costs for {} with violated criteria {}", violation.getArtefact().getName(), violation.getRequi...
QualityViolationCostsCalculator { public int calculateNonRemediationCosts(SonarConnectionSettings sonarConnectionSettings, ViolationOccurence violation) throws ResourceNotFoundException { log.info("Calculating non-remediation costs for {} with violated criteria {}", violation.getArtefact().getName(), violation.getRequi...
QualityViolationCostsCalculator { public int calculateNonRemediationCosts(SonarConnectionSettings sonarConnectionSettings, ViolationOccurence violation) throws ResourceNotFoundException { log.info("Calculating non-remediation costs for {} with violated criteria {}", violation.getArtefact().getName(), violation.getRequi...
@Test public void shouldConvertPackageNameToFilenameProperly() { assertThat(new Artefact("org.my.class.AbcDe", "").getFilename()).isEqualTo("org/my/class/AbcDe.java"); }
public String getFilename() { if (name.isEmpty()) { return ""; } return name.replace('.', '/') + ".java"; }
Artefact implements Serializable { public String getFilename() { if (name.isEmpty()) { return ""; } return name.replace('.', '/') + ".java"; } }
Artefact implements Serializable { public String getFilename() { if (name.isEmpty()) { return ""; } return name.replace('.', '/') + ".java"; } protected Artefact(); Artefact(String name, String sonarIdentifier); }
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(); }
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(); }
@Test public void shouldConvertClassNameToFilenameProperly() { assertThat(new Artefact("AbcDe", "").getFilename()).isEqualTo("AbcDe.java"); }
public String getFilename() { if (name.isEmpty()) { return ""; } return name.replace('.', '/') + ".java"; }
Artefact implements Serializable { public String getFilename() { if (name.isEmpty()) { return ""; } return name.replace('.', '/') + ".java"; } }
Artefact implements Serializable { public String getFilename() { if (name.isEmpty()) { return ""; } return name.replace('.', '/') + ".java"; } protected Artefact(); Artefact(String name, String sonarIdentifier); }
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(); }
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(); }
@Test public void shouldConvertEmptyPackageNameToFilenameProperly() { assertThat(new Artefact("", "").getFilename()).isEqualTo(""); }
public String getFilename() { if (name.isEmpty()) { return ""; } return name.replace('.', '/') + ".java"; }
Artefact implements Serializable { public String getFilename() { if (name.isEmpty()) { return ""; } return name.replace('.', '/') + ".java"; } }
Artefact implements Serializable { public String getFilename() { if (name.isEmpty()) { return ""; } return name.replace('.', '/') + ".java"; } protected Artefact(); Artefact(String name, String sonarIdentifier); }
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(); }
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(); }
@Test public void shouldConvertFullyQualifiedClassNameToShortClassName() { assertThat(new Artefact("org.util.MyClass", "").getShortClassName()).isEqualTo("MyClass"); }
public String getShortClassName() { String className = null; for (String packageName : Splitter.on('.').split(name)) { className = packageName; } return className; }
Artefact implements Serializable { public String getShortClassName() { String className = null; for (String packageName : Splitter.on('.').split(name)) { className = packageName; } return className; } }
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); }
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 getShortClassName()...
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 getShortClassName()...
@Test public void shouldConvertFullyQualifiedClassNameWithoutPackagesToShortClassName() { assertThat(new Artefact("Class123", "").getShortClassName()).isEqualTo("Class123"); }
public String getShortClassName() { String className = null; for (String packageName : Splitter.on('.').split(name)) { className = packageName; } return className; }
Artefact implements Serializable { public String getShortClassName() { String className = null; for (String packageName : Splitter.on('.').split(name)) { className = packageName; } return className; } }
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); }
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 getShortClassName()...
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 getShortClassName()...
@Test public void shouldConvertEmptyFullyQualifiedClassNameToShortClassName() { assertThat(new Artefact("", "").getShortClassName()).isEqualTo(""); }
public String getShortClassName() { String className = null; for (String packageName : Splitter.on('.').split(name)) { className = packageName; } return className; }
Artefact implements Serializable { public String getShortClassName() { String className = null; for (String packageName : Splitter.on('.').split(name)) { className = packageName; } return className; } }
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); }
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 getShortClassName()...
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 getShortClassName()...
@Test public void scheduleAllProjects() { analyzerRunsSchedulerOnStartup.onApplicationEvent(null); verify(analyzerScheduler).scheduleAnalyzer(projectA); verify(analyzerScheduler).scheduleAnalyzer(projectB); verify(analyzerScheduler).scheduleAnalyzer(projectC); }
@Override public void onApplicationEvent(ContextRefreshedEvent event) { if (alreadyExecuted.compareAndSet(false, true)) { List<Project> projects = projectRepository.findAll(); log.info("Schedule analyzer jobs for {} projects", projects.size()); for (Project project : projects) { analyzerScheduler.scheduleAnalyzer(proje...
QualityAnalyzerRunsSchedulerOnStartup implements ApplicationListener<ContextRefreshedEvent> { @Override public void onApplicationEvent(ContextRefreshedEvent event) { if (alreadyExecuted.compareAndSet(false, true)) { List<Project> projects = projectRepository.findAll(); log.info("Schedule analyzer jobs for {} projects",...
QualityAnalyzerRunsSchedulerOnStartup implements ApplicationListener<ContextRefreshedEvent> { @Override public void onApplicationEvent(ContextRefreshedEvent event) { if (alreadyExecuted.compareAndSet(false, true)) { List<Project> projects = projectRepository.findAll(); log.info("Schedule analyzer jobs for {} projects",...
QualityAnalyzerRunsSchedulerOnStartup implements ApplicationListener<ContextRefreshedEvent> { @Override public void onApplicationEvent(ContextRefreshedEvent event) { if (alreadyExecuted.compareAndSet(false, true)) { List<Project> projects = projectRepository.findAll(); log.info("Schedule analyzer jobs for {} projects",...
QualityAnalyzerRunsSchedulerOnStartup implements ApplicationListener<ContextRefreshedEvent> { @Override public void onApplicationEvent(ContextRefreshedEvent event) { if (alreadyExecuted.compareAndSet(false, true)) { List<Project> projects = projectRepository.findAll(); log.info("Schedule analyzer jobs for {} projects",...
@Test public void preventSchedulingProjectsTwice() { analyzerRunsSchedulerOnStartup.onApplicationEvent(null); analyzerRunsSchedulerOnStartup.onApplicationEvent(null); verify(analyzerScheduler, times(1)).scheduleAnalyzer(projectA); verify(analyzerScheduler, times(1)).scheduleAnalyzer(projectB); verify(analyzerScheduler,...
@Override public void onApplicationEvent(ContextRefreshedEvent event) { if (alreadyExecuted.compareAndSet(false, true)) { List<Project> projects = projectRepository.findAll(); log.info("Schedule analyzer jobs for {} projects", projects.size()); for (Project project : projects) { analyzerScheduler.scheduleAnalyzer(proje...
QualityAnalyzerRunsSchedulerOnStartup implements ApplicationListener<ContextRefreshedEvent> { @Override public void onApplicationEvent(ContextRefreshedEvent event) { if (alreadyExecuted.compareAndSet(false, true)) { List<Project> projects = projectRepository.findAll(); log.info("Schedule analyzer jobs for {} projects",...
QualityAnalyzerRunsSchedulerOnStartup implements ApplicationListener<ContextRefreshedEvent> { @Override public void onApplicationEvent(ContextRefreshedEvent event) { if (alreadyExecuted.compareAndSet(false, true)) { List<Project> projects = projectRepository.findAll(); log.info("Schedule analyzer jobs for {} projects",...
QualityAnalyzerRunsSchedulerOnStartup implements ApplicationListener<ContextRefreshedEvent> { @Override public void onApplicationEvent(ContextRefreshedEvent event) { if (alreadyExecuted.compareAndSet(false, true)) { List<Project> projects = projectRepository.findAll(); log.info("Schedule analyzer jobs for {} projects",...
QualityAnalyzerRunsSchedulerOnStartup implements ApplicationListener<ContextRefreshedEvent> { @Override public void onApplicationEvent(ContextRefreshedEvent event) { if (alreadyExecuted.compareAndSet(false, true)) { List<Project> projects = projectRepository.findAll(); log.info("Schedule analyzer jobs for {} projects",...
@Test public void shouldSupportSonarServerType() { assertThat(validator.supports(SonarServer.class)).isTrue(); }
@Override public boolean supports(Class<?> clazz) { return SonarServer.class.equals(clazz); }
SonarServerValidator implements Validator { @Override public boolean supports(Class<?> clazz) { return SonarServer.class.equals(clazz); } }
SonarServerValidator implements Validator { @Override public boolean supports(Class<?> clazz) { return SonarServer.class.equals(clazz); } }
SonarServerValidator implements Validator { @Override public boolean supports(Class<?> clazz) { return SonarServer.class.equals(clazz); } @Override boolean supports(Class<?> clazz); @Override void validate(Object target, Errors errors); }
SonarServerValidator implements Validator { @Override public boolean supports(Class<?> clazz) { return SonarServer.class.equals(clazz); } @Override boolean supports(Class<?> clazz); @Override void validate(Object target, Errors errors); }
@Test public void shouldChooseViolationWithBiggerRoiWhenProfitIsTheSame() { QualityViolation violationWithSmallerRoi = new QualityViolation(new Artefact("org.A", ""), createRequirementOnlyWithCriteria(new QualityCriteria("cc", "<", 5.0)), 50, 0, 0.0, "ncloc"); QualityViolation violationWithBiggerRoi = new QualityViolat...
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 shouldNotSupportOtherTypeThanSonarServer() { assertThat(validator.supports(Object.class)).isFalse(); }
@Override public boolean supports(Class<?> clazz) { return SonarServer.class.equals(clazz); }
SonarServerValidator implements Validator { @Override public boolean supports(Class<?> clazz) { return SonarServer.class.equals(clazz); } }
SonarServerValidator implements Validator { @Override public boolean supports(Class<?> clazz) { return SonarServer.class.equals(clazz); } }
SonarServerValidator implements Validator { @Override public boolean supports(Class<?> clazz) { return SonarServer.class.equals(clazz); } @Override boolean supports(Class<?> clazz); @Override void validate(Object target, Errors errors); }
SonarServerValidator implements Validator { @Override public boolean supports(Class<?> clazz) { return SonarServer.class.equals(clazz); } @Override boolean supports(Class<?> clazz); @Override void validate(Object target, Errors errors); }
@Test public void filterCorrectNumberOfBestRois() { Map<String, Integer> roiByArtefact = Maps.newHashMap(); roiByArtefact.put("A", 10); roiByArtefact.put("B", 10); roiByArtefact.put("C", 10); List<RoiDistribution> roiDistribution = Arrays.asList(new RoiDistribution(0, roiByArtefact)); assertThat(roiDistributionFilter.f...
Collection<RoiDistribution> filterHighestRoi(Collection<RoiDistribution> roiDistributions, int numberOfBestElements) { Map<Integer, RoiDistribution> filteredRoiDistributionsByInvest = Maps.newHashMap(); for (RoiDistribution distribution : roiDistributions) { filteredRoiDistributionsByInvest.put(distribution.getInvestIn...
RoiDistributionFilter { Collection<RoiDistribution> filterHighestRoi(Collection<RoiDistribution> roiDistributions, int numberOfBestElements) { Map<Integer, RoiDistribution> filteredRoiDistributionsByInvest = Maps.newHashMap(); for (RoiDistribution distribution : roiDistributions) { filteredRoiDistributionsByInvest.put(...
RoiDistributionFilter { Collection<RoiDistribution> filterHighestRoi(Collection<RoiDistribution> roiDistributions, int numberOfBestElements) { Map<Integer, RoiDistribution> filteredRoiDistributionsByInvest = Maps.newHashMap(); for (RoiDistribution distribution : roiDistributions) { filteredRoiDistributionsByInvest.put(...
RoiDistributionFilter { Collection<RoiDistribution> filterHighestRoi(Collection<RoiDistribution> roiDistributions, int numberOfBestElements) { Map<Integer, RoiDistribution> filteredRoiDistributionsByInvest = Maps.newHashMap(); for (RoiDistribution distribution : roiDistributions) { filteredRoiDistributionsByInvest.put(...
RoiDistributionFilter { Collection<RoiDistribution> filterHighestRoi(Collection<RoiDistribution> roiDistributions, int numberOfBestElements) { Map<Integer, RoiDistribution> filteredRoiDistributionsByInvest = Maps.newHashMap(); for (RoiDistribution distribution : roiDistributions) { filteredRoiDistributionsByInvest.put(...
@Test public void notFailWhenNumberOfArtefactsToFilterIsBiggerThanActualArtefacts() { Map<String, Integer> roiByArtefact = Maps.newHashMap(); roiByArtefact.put("A", 10); List<RoiDistribution> roiDistribution = Arrays.asList(new RoiDistribution(0, roiByArtefact)); assertThat(roiDistributionFilter.filterHighestRoi(roiDis...
Collection<RoiDistribution> filterHighestRoi(Collection<RoiDistribution> roiDistributions, int numberOfBestElements) { Map<Integer, RoiDistribution> filteredRoiDistributionsByInvest = Maps.newHashMap(); for (RoiDistribution distribution : roiDistributions) { filteredRoiDistributionsByInvest.put(distribution.getInvestIn...
RoiDistributionFilter { Collection<RoiDistribution> filterHighestRoi(Collection<RoiDistribution> roiDistributions, int numberOfBestElements) { Map<Integer, RoiDistribution> filteredRoiDistributionsByInvest = Maps.newHashMap(); for (RoiDistribution distribution : roiDistributions) { filteredRoiDistributionsByInvest.put(...
RoiDistributionFilter { Collection<RoiDistribution> filterHighestRoi(Collection<RoiDistribution> roiDistributions, int numberOfBestElements) { Map<Integer, RoiDistribution> filteredRoiDistributionsByInvest = Maps.newHashMap(); for (RoiDistribution distribution : roiDistributions) { filteredRoiDistributionsByInvest.put(...
RoiDistributionFilter { Collection<RoiDistribution> filterHighestRoi(Collection<RoiDistribution> roiDistributions, int numberOfBestElements) { Map<Integer, RoiDistribution> filteredRoiDistributionsByInvest = Maps.newHashMap(); for (RoiDistribution distribution : roiDistributions) { filteredRoiDistributionsByInvest.put(...
RoiDistributionFilter { Collection<RoiDistribution> filterHighestRoi(Collection<RoiDistribution> roiDistributions, int numberOfBestElements) { Map<Integer, RoiDistribution> filteredRoiDistributionsByInvest = Maps.newHashMap(); for (RoiDistribution distribution : roiDistributions) { filteredRoiDistributionsByInvest.put(...
@Test public void filterBestRoisFromOneDistribution() { Map<String, Integer> roiByArtefact = Maps.newHashMap(); roiByArtefact.put("A", 10); roiByArtefact.put("B", 11); roiByArtefact.put("C", 9); roiByArtefact.put("D", 12); List<RoiDistribution> roiDistribution = Arrays.asList(new RoiDistribution(0, roiByArtefact)); ass...
Collection<RoiDistribution> filterHighestRoi(Collection<RoiDistribution> roiDistributions, int numberOfBestElements) { Map<Integer, RoiDistribution> filteredRoiDistributionsByInvest = Maps.newHashMap(); for (RoiDistribution distribution : roiDistributions) { filteredRoiDistributionsByInvest.put(distribution.getInvestIn...
RoiDistributionFilter { Collection<RoiDistribution> filterHighestRoi(Collection<RoiDistribution> roiDistributions, int numberOfBestElements) { Map<Integer, RoiDistribution> filteredRoiDistributionsByInvest = Maps.newHashMap(); for (RoiDistribution distribution : roiDistributions) { filteredRoiDistributionsByInvest.put(...
RoiDistributionFilter { Collection<RoiDistribution> filterHighestRoi(Collection<RoiDistribution> roiDistributions, int numberOfBestElements) { Map<Integer, RoiDistribution> filteredRoiDistributionsByInvest = Maps.newHashMap(); for (RoiDistribution distribution : roiDistributions) { filteredRoiDistributionsByInvest.put(...
RoiDistributionFilter { Collection<RoiDistribution> filterHighestRoi(Collection<RoiDistribution> roiDistributions, int numberOfBestElements) { Map<Integer, RoiDistribution> filteredRoiDistributionsByInvest = Maps.newHashMap(); for (RoiDistribution distribution : roiDistributions) { filteredRoiDistributionsByInvest.put(...
RoiDistributionFilter { Collection<RoiDistribution> filterHighestRoi(Collection<RoiDistribution> roiDistributions, int numberOfBestElements) { Map<Integer, RoiDistribution> filteredRoiDistributionsByInvest = Maps.newHashMap(); for (RoiDistribution distribution : roiDistributions) { filteredRoiDistributionsByInvest.put(...
@Test public void filterBestRoisFromManyDistributions() { Map<String, Integer> roiByArtefactOneInvest = Maps.newHashMap(); roiByArtefactOneInvest.put("A", 10); roiByArtefactOneInvest.put("B", 1); roiByArtefactOneInvest.put("C", 2); roiByArtefactOneInvest.put("D", 9); roiByArtefactOneInvest.put("E", 8); Map<String, Inte...
Collection<RoiDistribution> filterHighestRoi(Collection<RoiDistribution> roiDistributions, int numberOfBestElements) { Map<Integer, RoiDistribution> filteredRoiDistributionsByInvest = Maps.newHashMap(); for (RoiDistribution distribution : roiDistributions) { filteredRoiDistributionsByInvest.put(distribution.getInvestIn...
RoiDistributionFilter { Collection<RoiDistribution> filterHighestRoi(Collection<RoiDistribution> roiDistributions, int numberOfBestElements) { Map<Integer, RoiDistribution> filteredRoiDistributionsByInvest = Maps.newHashMap(); for (RoiDistribution distribution : roiDistributions) { filteredRoiDistributionsByInvest.put(...
RoiDistributionFilter { Collection<RoiDistribution> filterHighestRoi(Collection<RoiDistribution> roiDistributions, int numberOfBestElements) { Map<Integer, RoiDistribution> filteredRoiDistributionsByInvest = Maps.newHashMap(); for (RoiDistribution distribution : roiDistributions) { filteredRoiDistributionsByInvest.put(...
RoiDistributionFilter { Collection<RoiDistribution> filterHighestRoi(Collection<RoiDistribution> roiDistributions, int numberOfBestElements) { Map<Integer, RoiDistribution> filteredRoiDistributionsByInvest = Maps.newHashMap(); for (RoiDistribution distribution : roiDistributions) { filteredRoiDistributionsByInvest.put(...
RoiDistributionFilter { Collection<RoiDistribution> filterHighestRoi(Collection<RoiDistribution> roiDistributions, int numberOfBestElements) { Map<Integer, RoiDistribution> filteredRoiDistributionsByInvest = Maps.newHashMap(); for (RoiDistribution distribution : roiDistributions) { filteredRoiDistributionsByInvest.put(...
@Test public void shouldSupportSonarConnectionSettingsType() { assertThat(validator.supports(SonarConnectionSettings.class)).isTrue(); }
@Override public boolean supports(Class<?> clazz) { return SonarConnectionSettings.class.equals(clazz); }
SonarConnectionSettingsValidator implements Validator { @Override public boolean supports(Class<?> clazz) { return SonarConnectionSettings.class.equals(clazz); } }
SonarConnectionSettingsValidator implements Validator { @Override public boolean supports(Class<?> clazz) { return SonarConnectionSettings.class.equals(clazz); } }
SonarConnectionSettingsValidator implements Validator { @Override public boolean supports(Class<?> clazz) { return SonarConnectionSettings.class.equals(clazz); } @Override boolean supports(Class<?> clazz); @Override void validate(Object target, Errors errors); }
SonarConnectionSettingsValidator implements Validator { @Override public boolean supports(Class<?> clazz) { return SonarConnectionSettings.class.equals(clazz); } @Override boolean supports(Class<?> clazz); @Override void validate(Object target, Errors errors); }
@Test public void shouldNotSupportOtherTypeThanSonarConnectionSettings() { assertThat(validator.supports(Object.class)).isFalse(); }
@Override public boolean supports(Class<?> clazz) { return SonarConnectionSettings.class.equals(clazz); }
SonarConnectionSettingsValidator implements Validator { @Override public boolean supports(Class<?> clazz) { return SonarConnectionSettings.class.equals(clazz); } }
SonarConnectionSettingsValidator implements Validator { @Override public boolean supports(Class<?> clazz) { return SonarConnectionSettings.class.equals(clazz); } }
SonarConnectionSettingsValidator implements Validator { @Override public boolean supports(Class<?> clazz) { return SonarConnectionSettings.class.equals(clazz); } @Override boolean supports(Class<?> clazz); @Override void validate(Object target, Errors errors); }
SonarConnectionSettingsValidator implements Validator { @Override public boolean supports(Class<?> clazz) { return SonarConnectionSettings.class.equals(clazz); } @Override boolean supports(Class<?> clazz); @Override void validate(Object target, Errors errors); }
@Test public void emptyAnalysis() throws IOException { QualityAnalysis analysis = QualityAnalysis.success(project, Collections.<QualityViolation>emptyList()); String expectedJson = "{ \"name\": \"Dummy Project\", \"allChildren\": [], \"children\": []}"; assertThat(generate(analysis).toString()).isEqualTo(mapper.readTre...
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 analysisWithOneArtefact() throws IOException { Artefact artefact = new Artefact("org.project.MyClass", "DUMMY"); artefact.setChangeProbability(0.6); QualityViolation violation = new QualityViolation(artefact, null, 5, 10, 0, ""); QualityAnalysis analysis = QualityAnalysis.success(project, Arrays.asLis...
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 analysisWithManyArtefactsAndManyViolations() throws IOException { Artefact artefact1 = new Artefact("project.A", "DUMMY"); Artefact artefact2 = new Artefact("project.B", "DUMMY"); Artefact artefact3 = new Artefact("project.test.util.C", "DUMMY"); Artefact artefact4 = new Artefact("project.test.util.D"...
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 shouldNotConsiderViolationsWithNegativeProfit() { when(profitCalculator.calculateProfit(any(QualityViolation.class))).thenReturn(-0.1); QualityInvestmentPlan qualityInvestmentPlan = investmentPlanService.computeInvestmentPlan(analysis, "", 50); assertThat(qualityInvestmentPlan.getProfitInMinutes()).is...
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 generatedClassWithoutAdapter() throws IOException { Retrofit retrofit = new Retrofit.Builder() .baseUrl(server.url("/")) .addConverterFactory(ThriftyConverterFactory.create(ProtocolType.BINARY)) .build(); BrokenService brokenService = retrofit.create(BrokenService.class); try { brokenService.get(); fa...
public static ThriftyConverterFactory create(ProtocolType protocolType) { return new ThriftyConverterFactory(protocolType); }
ThriftyConverterFactory extends Converter.Factory { public static ThriftyConverterFactory create(ProtocolType protocolType) { return new ThriftyConverterFactory(protocolType); } }
ThriftyConverterFactory extends Converter.Factory { public static ThriftyConverterFactory create(ProtocolType protocolType) { return new ThriftyConverterFactory(protocolType); } private ThriftyConverterFactory(ProtocolType protocolType); }
ThriftyConverterFactory extends Converter.Factory { public static ThriftyConverterFactory create(ProtocolType protocolType) { return new ThriftyConverterFactory(protocolType); } private ThriftyConverterFactory(ProtocolType protocolType); static ThriftyConverterFactory create(ProtocolType protocolType); @Override @Supp...
ThriftyConverterFactory extends Converter.Factory { public static ThriftyConverterFactory create(ProtocolType protocolType) { return new ThriftyConverterFactory(protocolType); } private ThriftyConverterFactory(ProtocolType protocolType); static ThriftyConverterFactory create(ProtocolType protocolType); @Override @Supp...
@Test public void testSetSensorOffset() { angles.setSensorOffset(Facing.BACK, 90); assertEquals(90, angles.mSensorOffset); angles.setSensorOffset(Facing.FRONT, 90); assertEquals(270, angles.mSensorOffset); }
public void setSensorOffset(@NonNull Facing sensorFacing, int sensorOffset) { sanitizeInput(sensorOffset); mSensorFacing = sensorFacing; mSensorOffset = sensorOffset; if (mSensorFacing == Facing.FRONT) { mSensorOffset = sanitizeOutput(360 - mSensorOffset); } print(); }
Angles { public void setSensorOffset(@NonNull Facing sensorFacing, int sensorOffset) { sanitizeInput(sensorOffset); mSensorFacing = sensorFacing; mSensorOffset = sensorOffset; if (mSensorFacing == Facing.FRONT) { mSensorOffset = sanitizeOutput(360 - mSensorOffset); } print(); } }
Angles { public void setSensorOffset(@NonNull Facing sensorFacing, int sensorOffset) { sanitizeInput(sensorOffset); mSensorFacing = sensorFacing; mSensorOffset = sensorOffset; if (mSensorFacing == Facing.FRONT) { mSensorOffset = sanitizeOutput(360 - mSensorOffset); } print(); } }
Angles { public void setSensorOffset(@NonNull Facing sensorFacing, int sensorOffset) { sanitizeInput(sensorOffset); mSensorFacing = sensorFacing; mSensorOffset = sensorOffset; if (mSensorFacing == Facing.FRONT) { mSensorOffset = sanitizeOutput(360 - mSensorOffset); } print(); } void setSensorOffset(@NonNull Facing sen...
Angles { public void setSensorOffset(@NonNull Facing sensorFacing, int sensorOffset) { sanitizeInput(sensorOffset); mSensorFacing = sensorFacing; mSensorOffset = sensorOffset; if (mSensorFacing == Facing.FRONT) { mSensorOffset = sanitizeOutput(360 - mSensorOffset); } print(); } void setSensorOffset(@NonNull Facing sen...
@Test public void testToString() { String string = pool.toString(); assertTrue(string.contains("count")); assertTrue(string.contains("active")); assertTrue(string.contains("recycled")); assertTrue(string.contains(Pool.class.getSimpleName())); }
@NonNull @Override public String toString() { return getClass().getSimpleName() + " - count:" + count() + ", active:" + activeCount() + ", recycled:" + recycledCount(); }
Pool { @NonNull @Override public String toString() { return getClass().getSimpleName() + " - count:" + count() + ", active:" + activeCount() + ", recycled:" + recycledCount(); } }
Pool { @NonNull @Override public String toString() { return getClass().getSimpleName() + " - count:" + count() + ", active:" + activeCount() + ", recycled:" + recycledCount(); } Pool(int maxPoolSize, @NonNull Factory<T> factory); }
Pool { @NonNull @Override public String toString() { return getClass().getSimpleName() + " - count:" + count() + ", active:" + activeCount() + ", recycled:" + recycledCount(); } Pool(int maxPoolSize, @NonNull Factory<T> factory); boolean isEmpty(); @Nullable T get(); void recycle(@NonNull T item); @CallSuper void clear...
Pool { @NonNull @Override public String toString() { return getClass().getSimpleName() + " - count:" + count() + ", active:" + activeCount() + ", recycled:" + recycledCount(); } Pool(int maxPoolSize, @NonNull Factory<T> factory); boolean isEmpty(); @Nullable T get(); void recycle(@NonNull T item); @CallSuper void clear...
@Test(expected = IllegalStateException.class) public void testRecycle_notActive() { Item item = new Item(); pool.recycle(item); }
public void recycle(@NonNull T item) { synchronized (lock) { LOG.v("RECYCLE - Recycling item.", this); if (--activeCount < 0) { throw new IllegalStateException("Trying to recycle an item which makes " + "activeCount < 0. This means that this or some previous items being " + "recycled were not coming from this pool, or ...
Pool { public void recycle(@NonNull T item) { synchronized (lock) { LOG.v("RECYCLE - Recycling item.", this); if (--activeCount < 0) { throw new IllegalStateException("Trying to recycle an item which makes " + "activeCount < 0. This means that this or some previous items being " + "recycled were not coming from this po...
Pool { public void recycle(@NonNull T item) { synchronized (lock) { LOG.v("RECYCLE - Recycling item.", this); if (--activeCount < 0) { throw new IllegalStateException("Trying to recycle an item which makes " + "activeCount < 0. This means that this or some previous items being " + "recycled were not coming from this po...
Pool { public void recycle(@NonNull T item) { synchronized (lock) { LOG.v("RECYCLE - Recycling item.", this); if (--activeCount < 0) { throw new IllegalStateException("Trying to recycle an item which makes " + "activeCount < 0. This means that this or some previous items being " + "recycled were not coming from this po...
Pool { public void recycle(@NonNull T item) { synchronized (lock) { LOG.v("RECYCLE - Recycling item.", this); if (--activeCount < 0) { throw new IllegalStateException("Trying to recycle an item which makes " + "activeCount < 0. This means that this or some previous items being " + "recycled were not coming from this po...
@Test public void testGet_fromFactory() { pool.get(); assertEquals(1, instances); }
@Nullable public T get() { synchronized (lock) { T item = queue.poll(); if (item != null) { activeCount++; LOG.v("GET - Reusing recycled item.", this); return item; } if (isEmpty()) { LOG.v("GET - Returning null. Too much items requested.", this); return null; } activeCount++; LOG.v("GET - Creating a new item.", this);...
Pool { @Nullable public T get() { synchronized (lock) { T item = queue.poll(); if (item != null) { activeCount++; LOG.v("GET - Reusing recycled item.", this); return item; } if (isEmpty()) { LOG.v("GET - Returning null. Too much items requested.", this); return null; } activeCount++; LOG.v("GET - Creating a new item.",...
Pool { @Nullable public T get() { synchronized (lock) { T item = queue.poll(); if (item != null) { activeCount++; LOG.v("GET - Reusing recycled item.", this); return item; } if (isEmpty()) { LOG.v("GET - Returning null. Too much items requested.", this); return null; } activeCount++; LOG.v("GET - Creating a new item.",...
Pool { @Nullable public T get() { synchronized (lock) { T item = queue.poll(); if (item != null) { activeCount++; LOG.v("GET - Reusing recycled item.", this); return item; } if (isEmpty()) { LOG.v("GET - Returning null. Too much items requested.", this); return null; } activeCount++; LOG.v("GET - Creating a new item.",...
Pool { @Nullable public T get() { synchronized (lock) { T item = queue.poll(); if (item != null) { activeCount++; LOG.v("GET - Reusing recycled item.", this); return item; } if (isEmpty()) { LOG.v("GET - Returning null. Too much items requested.", this); return null; } activeCount++; LOG.v("GET - Creating a new item.",...
@Test public void testGet_whenFull() { for (int i = 0; i < MAX_SIZE; i++) { pool.get(); } assertNull(pool.get()); }
@Nullable public T get() { synchronized (lock) { T item = queue.poll(); if (item != null) { activeCount++; LOG.v("GET - Reusing recycled item.", this); return item; } if (isEmpty()) { LOG.v("GET - Returning null. Too much items requested.", this); return null; } activeCount++; LOG.v("GET - Creating a new item.", this);...
Pool { @Nullable public T get() { synchronized (lock) { T item = queue.poll(); if (item != null) { activeCount++; LOG.v("GET - Reusing recycled item.", this); return item; } if (isEmpty()) { LOG.v("GET - Returning null. Too much items requested.", this); return null; } activeCount++; LOG.v("GET - Creating a new item.",...
Pool { @Nullable public T get() { synchronized (lock) { T item = queue.poll(); if (item != null) { activeCount++; LOG.v("GET - Reusing recycled item.", this); return item; } if (isEmpty()) { LOG.v("GET - Returning null. Too much items requested.", this); return null; } activeCount++; LOG.v("GET - Creating a new item.",...
Pool { @Nullable public T get() { synchronized (lock) { T item = queue.poll(); if (item != null) { activeCount++; LOG.v("GET - Reusing recycled item.", this); return item; } if (isEmpty()) { LOG.v("GET - Returning null. Too much items requested.", this); return null; } activeCount++; LOG.v("GET - Creating a new item.",...
Pool { @Nullable public T get() { synchronized (lock) { T item = queue.poll(); if (item != null) { activeCount++; LOG.v("GET - Reusing recycled item.", this); return item; } if (isEmpty()) { LOG.v("GET - Returning null. Too much items requested.", this); return null; } activeCount++; LOG.v("GET - Creating a new item.",...
@Test public void testEquals() { Frame f1 = new Frame(manager); long time = 1000; f1.setContent("foo", time, 90, 180, new Size(5, 5), ImageFormat.NV21); Frame f2 = new Frame(manager); f2.setContent("bar", time, 0, 90, new Size(10, 10), ImageFormat.NV21); assertEquals(f1, f2); f2.setContent("foo", time + 1, 0, 90, new S...
@Override public boolean equals(Object obj) { return obj instanceof Frame && ((Frame) obj).mTime == mTime; }
Frame { @Override public boolean equals(Object obj) { return obj instanceof Frame && ((Frame) obj).mTime == mTime; } }
Frame { @Override public boolean equals(Object obj) { return obj instanceof Frame && ((Frame) obj).mTime == mTime; } Frame(@NonNull FrameManager manager); }
Frame { @Override public boolean equals(Object obj) { return obj instanceof Frame && ((Frame) obj).mTime == mTime; } Frame(@NonNull FrameManager manager); @Override boolean equals(Object obj); @SuppressLint("NewApi") @NonNull Frame freeze(); void release(); @SuppressWarnings("unchecked") @NonNull T getData(); @NonNull ...
Frame { @Override public boolean equals(Object obj) { return obj instanceof Frame && ((Frame) obj).mTime == mTime; } Frame(@NonNull FrameManager manager); @Override boolean equals(Object obj); @SuppressLint("NewApi") @NonNull Frame freeze(); void release(); @SuppressWarnings("unchecked") @NonNull T getData(); @NonNull ...
@Test public void testFreeze() { Frame frame = new Frame(manager); String data = "test data"; long time = 1000; int userRotation = 90; int viewRotation = 90; Size size = new Size(10, 10); int format = ImageFormat.NV21; frame.setContent(data, time, userRotation, viewRotation, size, format); Frame frozen = frame.freeze()...
@SuppressLint("NewApi") @NonNull public Frame freeze() { ensureHasContent(); Frame other = new Frame(mManager); Object data = mManager.cloneFrameData(getData()); other.setContent(data, mTime, mUserRotation, mViewRotation, mSize, mFormat); return other; }
Frame { @SuppressLint("NewApi") @NonNull public Frame freeze() { ensureHasContent(); Frame other = new Frame(mManager); Object data = mManager.cloneFrameData(getData()); other.setContent(data, mTime, mUserRotation, mViewRotation, mSize, mFormat); return other; } }
Frame { @SuppressLint("NewApi") @NonNull public Frame freeze() { ensureHasContent(); Frame other = new Frame(mManager); Object data = mManager.cloneFrameData(getData()); other.setContent(data, mTime, mUserRotation, mViewRotation, mSize, mFormat); return other; } Frame(@NonNull FrameManager manager); }
Frame { @SuppressLint("NewApi") @NonNull public Frame freeze() { ensureHasContent(); Frame other = new Frame(mManager); Object data = mManager.cloneFrameData(getData()); other.setContent(data, mTime, mUserRotation, mViewRotation, mSize, mFormat); return other; } Frame(@NonNull FrameManager manager); @Override boolean e...
Frame { @SuppressLint("NewApi") @NonNull public Frame freeze() { ensureHasContent(); Frame other = new Frame(mManager); Object data = mManager.cloneFrameData(getData()); other.setContent(data, mTime, mUserRotation, mViewRotation, mSize, mFormat); return other; } Frame(@NonNull FrameManager manager); @Override boolean e...
@Test public void testEquals() { AspectRatio ratio = AspectRatio.of(50, 10); assertNotNull(ratio); assertEquals(ratio, ratio); AspectRatio ratio1 = AspectRatio.of(5, 1); assertEquals(ratio, ratio1); AspectRatio.sCache.clear(); AspectRatio ratio2 = AspectRatio.of(500, 100); assertEquals(ratio, ratio2); Size size = new S...
@Override public boolean equals(Object o) { if (o == null) { return false; } if (this == o) { return true; } if (o instanceof AspectRatio) { return toFloat() == ((AspectRatio) o).toFloat(); } return false; }
AspectRatio implements Comparable<AspectRatio> { @Override public boolean equals(Object o) { if (o == null) { return false; } if (this == o) { return true; } if (o instanceof AspectRatio) { return toFloat() == ((AspectRatio) o).toFloat(); } return false; } }
AspectRatio implements Comparable<AspectRatio> { @Override public boolean equals(Object o) { if (o == null) { return false; } if (this == o) { return true; } if (o instanceof AspectRatio) { return toFloat() == ((AspectRatio) o).toFloat(); } return false; } private AspectRatio(int x, int y); }
AspectRatio implements Comparable<AspectRatio> { @Override public boolean equals(Object o) { if (o == null) { return false; } if (this == o) { return true; } if (o instanceof AspectRatio) { return toFloat() == ((AspectRatio) o).toFloat(); } return false; } private AspectRatio(int x, int y); @NonNull static AspectRatio...
AspectRatio implements Comparable<AspectRatio> { @Override public boolean equals(Object o) { if (o == null) { return false; } if (this == o) { return true; } if (o instanceof AspectRatio) { return toFloat() == ((AspectRatio) o).toFloat(); } return false; } private AspectRatio(int x, int y); @NonNull static AspectRatio...
@Test(expected = NumberFormatException.class) public void testParse_notNumbers() { AspectRatio.parse("a:b"); }
@NonNull @SuppressWarnings("WeakerAccess") public static AspectRatio parse(@NonNull String string) { String[] parts = string.split(":"); if (parts.length != 2) { throw new NumberFormatException("Illegal AspectRatio string. Must be x:y"); } int x = Integer.parseInt(parts[0]); int y = Integer.parseInt(parts[1]); return o...
AspectRatio implements Comparable<AspectRatio> { @NonNull @SuppressWarnings("WeakerAccess") public static AspectRatio parse(@NonNull String string) { String[] parts = string.split(":"); if (parts.length != 2) { throw new NumberFormatException("Illegal AspectRatio string. Must be x:y"); } int x = Integer.parseInt(parts[...
AspectRatio implements Comparable<AspectRatio> { @NonNull @SuppressWarnings("WeakerAccess") public static AspectRatio parse(@NonNull String string) { String[] parts = string.split(":"); if (parts.length != 2) { throw new NumberFormatException("Illegal AspectRatio string. Must be x:y"); } int x = Integer.parseInt(parts[...
AspectRatio implements Comparable<AspectRatio> { @NonNull @SuppressWarnings("WeakerAccess") public static AspectRatio parse(@NonNull String string) { String[] parts = string.split(":"); if (parts.length != 2) { throw new NumberFormatException("Illegal AspectRatio string. Must be x:y"); } int x = Integer.parseInt(parts[...
AspectRatio implements Comparable<AspectRatio> { @NonNull @SuppressWarnings("WeakerAccess") public static AspectRatio parse(@NonNull String string) { String[] parts = string.split(":"); if (parts.length != 2) { throw new NumberFormatException("Illegal AspectRatio string. Must be x:y"); } int x = Integer.parseInt(parts[...
@Test(expected = NumberFormatException.class) public void testParse_noColon() { AspectRatio.parse("24"); }
@NonNull @SuppressWarnings("WeakerAccess") public static AspectRatio parse(@NonNull String string) { String[] parts = string.split(":"); if (parts.length != 2) { throw new NumberFormatException("Illegal AspectRatio string. Must be x:y"); } int x = Integer.parseInt(parts[0]); int y = Integer.parseInt(parts[1]); return o...
AspectRatio implements Comparable<AspectRatio> { @NonNull @SuppressWarnings("WeakerAccess") public static AspectRatio parse(@NonNull String string) { String[] parts = string.split(":"); if (parts.length != 2) { throw new NumberFormatException("Illegal AspectRatio string. Must be x:y"); } int x = Integer.parseInt(parts[...
AspectRatio implements Comparable<AspectRatio> { @NonNull @SuppressWarnings("WeakerAccess") public static AspectRatio parse(@NonNull String string) { String[] parts = string.split(":"); if (parts.length != 2) { throw new NumberFormatException("Illegal AspectRatio string. Must be x:y"); } int x = Integer.parseInt(parts[...
AspectRatio implements Comparable<AspectRatio> { @NonNull @SuppressWarnings("WeakerAccess") public static AspectRatio parse(@NonNull String string) { String[] parts = string.split(":"); if (parts.length != 2) { throw new NumberFormatException("Illegal AspectRatio string. Must be x:y"); } int x = Integer.parseInt(parts[...
AspectRatio implements Comparable<AspectRatio> { @NonNull @SuppressWarnings("WeakerAccess") public static AspectRatio parse(@NonNull String string) { String[] parts = string.split(":"); if (parts.length != 2) { throw new NumberFormatException("Illegal AspectRatio string. Must be x:y"); } int x = Integer.parseInt(parts[...
@Test public void testParse() { AspectRatio ratio = AspectRatio.parse("16:9"); assertEquals(ratio.getX(), 16); assertEquals(ratio.getY(), 9); }
@NonNull @SuppressWarnings("WeakerAccess") public static AspectRatio parse(@NonNull String string) { String[] parts = string.split(":"); if (parts.length != 2) { throw new NumberFormatException("Illegal AspectRatio string. Must be x:y"); } int x = Integer.parseInt(parts[0]); int y = Integer.parseInt(parts[1]); return o...
AspectRatio implements Comparable<AspectRatio> { @NonNull @SuppressWarnings("WeakerAccess") public static AspectRatio parse(@NonNull String string) { String[] parts = string.split(":"); if (parts.length != 2) { throw new NumberFormatException("Illegal AspectRatio string. Must be x:y"); } int x = Integer.parseInt(parts[...
AspectRatio implements Comparable<AspectRatio> { @NonNull @SuppressWarnings("WeakerAccess") public static AspectRatio parse(@NonNull String string) { String[] parts = string.split(":"); if (parts.length != 2) { throw new NumberFormatException("Illegal AspectRatio string. Must be x:y"); } int x = Integer.parseInt(parts[...
AspectRatio implements Comparable<AspectRatio> { @NonNull @SuppressWarnings("WeakerAccess") public static AspectRatio parse(@NonNull String string) { String[] parts = string.split(":"); if (parts.length != 2) { throw new NumberFormatException("Illegal AspectRatio string. Must be x:y"); } int x = Integer.parseInt(parts[...
AspectRatio implements Comparable<AspectRatio> { @NonNull @SuppressWarnings("WeakerAccess") public static AspectRatio parse(@NonNull String string) { String[] parts = string.split(":"); if (parts.length != 2) { throw new NumberFormatException("Illegal AspectRatio string. Must be x:y"); } int x = Integer.parseInt(parts[...
@Test public void testSetDisplayOffset() { angles.setDisplayOffset(90); assertEquals(90, angles.mDisplayOffset); }
public void setDisplayOffset(int displayOffset) { sanitizeInput(displayOffset); mDisplayOffset = displayOffset; print(); }
Angles { public void setDisplayOffset(int displayOffset) { sanitizeInput(displayOffset); mDisplayOffset = displayOffset; print(); } }
Angles { public void setDisplayOffset(int displayOffset) { sanitizeInput(displayOffset); mDisplayOffset = displayOffset; print(); } }
Angles { public void setDisplayOffset(int displayOffset) { sanitizeInput(displayOffset); mDisplayOffset = displayOffset; print(); } void setSensorOffset(@NonNull Facing sensorFacing, int sensorOffset); void setDisplayOffset(int displayOffset); void setDeviceOrientation(int deviceOrientation); int offset(@NonNull Refer...
Angles { public void setDisplayOffset(int displayOffset) { sanitizeInput(displayOffset); mDisplayOffset = displayOffset; print(); } void setSensorOffset(@NonNull Facing sensorFacing, int sensorOffset); void setDisplayOffset(int displayOffset); void setDeviceOrientation(int deviceOrientation); int offset(@NonNull Refer...
@Test public void testFlip() { Size size = new Size(10, 20); Size flipped = size.flip(); assertEquals(size.getWidth(), flipped.getHeight()); assertEquals(size.getHeight(), flipped.getWidth()); }
@SuppressWarnings("SuspiciousNameCombination") public Size flip() { return new Size(mHeight, mWidth); }
Size implements Comparable<Size> { @SuppressWarnings("SuspiciousNameCombination") public Size flip() { return new Size(mHeight, mWidth); } }
Size implements Comparable<Size> { @SuppressWarnings("SuspiciousNameCombination") public Size flip() { return new Size(mHeight, mWidth); } Size(int width, int height); }
Size implements Comparable<Size> { @SuppressWarnings("SuspiciousNameCombination") public Size flip() { return new Size(mHeight, mWidth); } Size(int width, int height); int getWidth(); int getHeight(); @SuppressWarnings("SuspiciousNameCombination") Size flip(); @Override boolean equals(Object o); @NonNull @Override Stri...
Size implements Comparable<Size> { @SuppressWarnings("SuspiciousNameCombination") public Size flip() { return new Size(mHeight, mWidth); } Size(int width, int height); int getWidth(); int getHeight(); @SuppressWarnings("SuspiciousNameCombination") Size flip(); @Override boolean equals(Object o); @NonNull @Override Stri...
@Test public void testEquals() { Size s1 = new Size(10, 20); assertEquals(s1, s1); assertNotEquals(s1, null); assertNotEquals(s1, ""); Size s2 = new Size(10, 0); Size s3 = new Size(10, 20); assertEquals(s1, s3); assertNotEquals(s1, s2); }
@Override public boolean equals(Object o) { if (o == null) { return false; } if (this == o) { return true; } if (o instanceof Size) { Size size = (Size) o; return mWidth == size.mWidth && mHeight == size.mHeight; } return false; }
Size implements Comparable<Size> { @Override public boolean equals(Object o) { if (o == null) { return false; } if (this == o) { return true; } if (o instanceof Size) { Size size = (Size) o; return mWidth == size.mWidth && mHeight == size.mHeight; } return false; } }
Size implements Comparable<Size> { @Override public boolean equals(Object o) { if (o == null) { return false; } if (this == o) { return true; } if (o instanceof Size) { Size size = (Size) o; return mWidth == size.mWidth && mHeight == size.mHeight; } return false; } Size(int width, int height); }
Size implements Comparable<Size> { @Override public boolean equals(Object o) { if (o == null) { return false; } if (this == o) { return true; } if (o instanceof Size) { Size size = (Size) o; return mWidth == size.mWidth && mHeight == size.mHeight; } return false; } Size(int width, int height); int getWidth(); int getHe...
Size implements Comparable<Size> { @Override public boolean equals(Object o) { if (o == null) { return false; } if (this == o) { return true; } if (o instanceof Size) { Size size = (Size) o; return mWidth == size.mWidth && mHeight == size.mHeight; } return false; } Size(int width, int height); int getWidth(); int getHe...
@Test public void testHashCode() { Size s1 = new Size(10, 20); Size s2 = new Size(10, 0); assertNotEquals(s1.hashCode(), s2.hashCode()); }
@Override public int hashCode() { return mHeight ^ ((mWidth << (Integer.SIZE / 2)) | (mWidth >>> (Integer.SIZE / 2))); }
Size implements Comparable<Size> { @Override public int hashCode() { return mHeight ^ ((mWidth << (Integer.SIZE / 2)) | (mWidth >>> (Integer.SIZE / 2))); } }
Size implements Comparable<Size> { @Override public int hashCode() { return mHeight ^ ((mWidth << (Integer.SIZE / 2)) | (mWidth >>> (Integer.SIZE / 2))); } Size(int width, int height); }
Size implements Comparable<Size> { @Override public int hashCode() { return mHeight ^ ((mWidth << (Integer.SIZE / 2)) | (mWidth >>> (Integer.SIZE / 2))); } Size(int width, int height); int getWidth(); int getHeight(); @SuppressWarnings("SuspiciousNameCombination") Size flip(); @Override boolean equals(Object o); @NonNu...
Size implements Comparable<Size> { @Override public int hashCode() { return mHeight ^ ((mWidth << (Integer.SIZE / 2)) | (mWidth >>> (Integer.SIZE / 2))); } Size(int width, int height); int getWidth(); int getHeight(); @SuppressWarnings("SuspiciousNameCombination") Size flip(); @Override boolean equals(Object o); @NonNu...
@Test public void testCompare() { Size s1 = new Size(10, 20); Size s2 = new Size(10, 0); Size s3 = new Size(10, 20); assertTrue(s1.compareTo(s3) == 0); assertTrue(s1.compareTo(s2) > 0); assertTrue(s2.compareTo(s1) < 0); }
@Override public int compareTo(@NonNull Size another) { return mWidth * mHeight - another.mWidth * another.mHeight; }
Size implements Comparable<Size> { @Override public int compareTo(@NonNull Size another) { return mWidth * mHeight - another.mWidth * another.mHeight; } }
Size implements Comparable<Size> { @Override public int compareTo(@NonNull Size another) { return mWidth * mHeight - another.mWidth * another.mHeight; } Size(int width, int height); }
Size implements Comparable<Size> { @Override public int compareTo(@NonNull Size another) { return mWidth * mHeight - another.mWidth * another.mHeight; } Size(int width, int height); int getWidth(); int getHeight(); @SuppressWarnings("SuspiciousNameCombination") Size flip(); @Override boolean equals(Object o); @NonNull ...
Size implements Comparable<Size> { @Override public int compareTo(@NonNull Size another) { return mWidth * mHeight - another.mWidth * another.mHeight; } Size(int width, int height); int getWidth(); int getHeight(); @SuppressWarnings("SuspiciousNameCombination") Size flip(); @Override boolean equals(Object o); @NonNull ...
@Test public void testWithFilter() { SizeSelector selector = SizeSelectors.withFilter(new SizeSelectors.Filter() { @Override public boolean accepts(@NonNull Size size) { return size.getWidth() == 600; } }); List<Size> list = selector.select(input); assertEquals(list.size(), 2); assertEquals(list.get(0), new Size(600, 9...
@SuppressWarnings("WeakerAccess") @NonNull public static SizeSelector withFilter(@NonNull Filter filter) { return new FilterSelector(filter); }
SizeSelectors { @SuppressWarnings("WeakerAccess") @NonNull public static SizeSelector withFilter(@NonNull Filter filter) { return new FilterSelector(filter); } }
SizeSelectors { @SuppressWarnings("WeakerAccess") @NonNull public static SizeSelector withFilter(@NonNull Filter filter) { return new FilterSelector(filter); } }
SizeSelectors { @SuppressWarnings("WeakerAccess") @NonNull public static SizeSelector withFilter(@NonNull Filter filter) { return new FilterSelector(filter); } @SuppressWarnings("WeakerAccess") @NonNull static SizeSelector withFilter(@NonNull Filter filter); @NonNull static SizeSelector maxWidth(final int width); @Non...
SizeSelectors { @SuppressWarnings("WeakerAccess") @NonNull public static SizeSelector withFilter(@NonNull Filter filter) { return new FilterSelector(filter); } @SuppressWarnings("WeakerAccess") @NonNull static SizeSelector withFilter(@NonNull Filter filter); @NonNull static SizeSelector maxWidth(final int width); @Non...
@Test public void testMaxWidth() { SizeSelector selector = SizeSelectors.maxWidth(50); List<Size> list = selector.select(input); assertEquals(list.size(), 2); assertEquals(list.get(0), new Size(30, 40)); assertEquals(list.get(1), new Size(40, 30)); }
@NonNull public static SizeSelector maxWidth(final int width) { return withFilter(new Filter() { @Override public boolean accepts(@NonNull Size size) { return size.getWidth() <= width; } }); }
SizeSelectors { @NonNull public static SizeSelector maxWidth(final int width) { return withFilter(new Filter() { @Override public boolean accepts(@NonNull Size size) { return size.getWidth() <= width; } }); } }
SizeSelectors { @NonNull public static SizeSelector maxWidth(final int width) { return withFilter(new Filter() { @Override public boolean accepts(@NonNull Size size) { return size.getWidth() <= width; } }); } }
SizeSelectors { @NonNull public static SizeSelector maxWidth(final int width) { return withFilter(new Filter() { @Override public boolean accepts(@NonNull Size size) { return size.getWidth() <= width; } }); } @SuppressWarnings("WeakerAccess") @NonNull static SizeSelector withFilter(@NonNull Filter filter); @NonNull st...
SizeSelectors { @NonNull public static SizeSelector maxWidth(final int width) { return withFilter(new Filter() { @Override public boolean accepts(@NonNull Size size) { return size.getWidth() <= width; } }); } @SuppressWarnings("WeakerAccess") @NonNull static SizeSelector withFilter(@NonNull Filter filter); @NonNull st...
@Test public void testMinWidth() { SizeSelector selector = SizeSelectors.minWidth(1000); List<Size> list = selector.select(input); assertEquals(list.size(), 2); assertEquals(list.get(0), new Size(1600, 900)); assertEquals(list.get(1), new Size(2000, 4000)); }
@NonNull public static SizeSelector minWidth(final int width) { return withFilter(new Filter() { @Override public boolean accepts(@NonNull Size size) { return size.getWidth() >= width; } }); }
SizeSelectors { @NonNull public static SizeSelector minWidth(final int width) { return withFilter(new Filter() { @Override public boolean accepts(@NonNull Size size) { return size.getWidth() >= width; } }); } }
SizeSelectors { @NonNull public static SizeSelector minWidth(final int width) { return withFilter(new Filter() { @Override public boolean accepts(@NonNull Size size) { return size.getWidth() >= width; } }); } }
SizeSelectors { @NonNull public static SizeSelector minWidth(final int width) { return withFilter(new Filter() { @Override public boolean accepts(@NonNull Size size) { return size.getWidth() >= width; } }); } @SuppressWarnings("WeakerAccess") @NonNull static SizeSelector withFilter(@NonNull Filter filter); @NonNull st...
SizeSelectors { @NonNull public static SizeSelector minWidth(final int width) { return withFilter(new Filter() { @Override public boolean accepts(@NonNull Size size) { return size.getWidth() >= width; } }); } @SuppressWarnings("WeakerAccess") @NonNull static SizeSelector withFilter(@NonNull Filter filter); @NonNull st...
@Test public void testMaxHeight() { SizeSelector selector = SizeSelectors.maxHeight(50); List<Size> list = selector.select(input); assertEquals(list.size(), 2); assertEquals(list.get(0), new Size(30, 40)); assertEquals(list.get(1), new Size(40, 30)); }
@SuppressWarnings("WeakerAccess") @NonNull public static SizeSelector maxHeight(final int height) { return withFilter(new Filter() { @Override public boolean accepts(@NonNull Size size) { return size.getHeight() <= height; } }); }
SizeSelectors { @SuppressWarnings("WeakerAccess") @NonNull public static SizeSelector maxHeight(final int height) { return withFilter(new Filter() { @Override public boolean accepts(@NonNull Size size) { return size.getHeight() <= height; } }); } }
SizeSelectors { @SuppressWarnings("WeakerAccess") @NonNull public static SizeSelector maxHeight(final int height) { return withFilter(new Filter() { @Override public boolean accepts(@NonNull Size size) { return size.getHeight() <= height; } }); } }
SizeSelectors { @SuppressWarnings("WeakerAccess") @NonNull public static SizeSelector maxHeight(final int height) { return withFilter(new Filter() { @Override public boolean accepts(@NonNull Size size) { return size.getHeight() <= height; } }); } @SuppressWarnings("WeakerAccess") @NonNull static SizeSelector withFilte...
SizeSelectors { @SuppressWarnings("WeakerAccess") @NonNull public static SizeSelector maxHeight(final int height) { return withFilter(new Filter() { @Override public boolean accepts(@NonNull Size size) { return size.getHeight() <= height; } }); } @SuppressWarnings("WeakerAccess") @NonNull static SizeSelector withFilte...
@Test public void testMinHeight() { SizeSelector selector = SizeSelectors.minHeight(1000); List<Size> list = selector.select(input); assertEquals(list.size(), 1); assertEquals(list.get(0), new Size(2000, 4000)); }
@NonNull public static SizeSelector minHeight(final int height) { return withFilter(new Filter() { @Override public boolean accepts(@NonNull Size size) { return size.getHeight() >= height; } }); }
SizeSelectors { @NonNull public static SizeSelector minHeight(final int height) { return withFilter(new Filter() { @Override public boolean accepts(@NonNull Size size) { return size.getHeight() >= height; } }); } }
SizeSelectors { @NonNull public static SizeSelector minHeight(final int height) { return withFilter(new Filter() { @Override public boolean accepts(@NonNull Size size) { return size.getHeight() >= height; } }); } }
SizeSelectors { @NonNull public static SizeSelector minHeight(final int height) { return withFilter(new Filter() { @Override public boolean accepts(@NonNull Size size) { return size.getHeight() >= height; } }); } @SuppressWarnings("WeakerAccess") @NonNull static SizeSelector withFilter(@NonNull Filter filter); @NonNul...
SizeSelectors { @NonNull public static SizeSelector minHeight(final int height) { return withFilter(new Filter() { @Override public boolean accepts(@NonNull Size size) { return size.getHeight() >= height; } }); } @SuppressWarnings("WeakerAccess") @NonNull static SizeSelector withFilter(@NonNull Filter filter); @NonNul...
@Test public void testAspectRatio() { SizeSelector selector = SizeSelectors.aspectRatio(AspectRatio.of(16, 9), 0); List<Size> list = selector.select(input); assertEquals(list.size(), 1); assertEquals(list.get(0), new Size(1600, 900)); selector = SizeSelectors.aspectRatio(AspectRatio.of(1, 2), 0); list = selector.select...
@SuppressWarnings("WeakerAccess") @NonNull public static SizeSelector aspectRatio(AspectRatio ratio, final float delta) { final float desired = ratio.toFloat(); return withFilter(new Filter() { @Override public boolean accepts(@NonNull Size size) { float candidate = AspectRatio.of(size.getWidth(), size.getHeight()).toF...
SizeSelectors { @SuppressWarnings("WeakerAccess") @NonNull public static SizeSelector aspectRatio(AspectRatio ratio, final float delta) { final float desired = ratio.toFloat(); return withFilter(new Filter() { @Override public boolean accepts(@NonNull Size size) { float candidate = AspectRatio.of(size.getWidth(), size....
SizeSelectors { @SuppressWarnings("WeakerAccess") @NonNull public static SizeSelector aspectRatio(AspectRatio ratio, final float delta) { final float desired = ratio.toFloat(); return withFilter(new Filter() { @Override public boolean accepts(@NonNull Size size) { float candidate = AspectRatio.of(size.getWidth(), size....
SizeSelectors { @SuppressWarnings("WeakerAccess") @NonNull public static SizeSelector aspectRatio(AspectRatio ratio, final float delta) { final float desired = ratio.toFloat(); return withFilter(new Filter() { @Override public boolean accepts(@NonNull Size size) { float candidate = AspectRatio.of(size.getWidth(), size....
SizeSelectors { @SuppressWarnings("WeakerAccess") @NonNull public static SizeSelector aspectRatio(AspectRatio ratio, final float delta) { final float desired = ratio.toFloat(); return withFilter(new Filter() { @Override public boolean accepts(@NonNull Size size) { float candidate = AspectRatio.of(size.getWidth(), size....
@Test public void testSetDeviceOrientation() { angles.setDeviceOrientation(90); assertEquals(90, angles.mDeviceOrientation); }
public void setDeviceOrientation(int deviceOrientation) { sanitizeInput(deviceOrientation); mDeviceOrientation = deviceOrientation; print(); }
Angles { public void setDeviceOrientation(int deviceOrientation) { sanitizeInput(deviceOrientation); mDeviceOrientation = deviceOrientation; print(); } }
Angles { public void setDeviceOrientation(int deviceOrientation) { sanitizeInput(deviceOrientation); mDeviceOrientation = deviceOrientation; print(); } }
Angles { public void setDeviceOrientation(int deviceOrientation) { sanitizeInput(deviceOrientation); mDeviceOrientation = deviceOrientation; print(); } void setSensorOffset(@NonNull Facing sensorFacing, int sensorOffset); void setDisplayOffset(int displayOffset); void setDeviceOrientation(int deviceOrientation); int o...
Angles { public void setDeviceOrientation(int deviceOrientation) { sanitizeInput(deviceOrientation); mDeviceOrientation = deviceOrientation; print(); } void setSensorOffset(@NonNull Facing sensorFacing, int sensorOffset); void setDisplayOffset(int displayOffset); void setDeviceOrientation(int deviceOrientation); int o...
@Test public void testMax() { SizeSelector selector = SizeSelectors.biggest(); List<Size> list = selector.select(input); assertEquals(list.size(), input.size()); assertEquals(list.get(0), new Size(2000, 4000)); }
@SuppressWarnings("WeakerAccess") @NonNull public static SizeSelector biggest() { return new SizeSelector() { @NonNull @Override public List<Size> select(@NonNull List<Size> source) { Collections.sort(source); Collections.reverse(source); return source; } }; }
SizeSelectors { @SuppressWarnings("WeakerAccess") @NonNull public static SizeSelector biggest() { return new SizeSelector() { @NonNull @Override public List<Size> select(@NonNull List<Size> source) { Collections.sort(source); Collections.reverse(source); return source; } }; } }
SizeSelectors { @SuppressWarnings("WeakerAccess") @NonNull public static SizeSelector biggest() { return new SizeSelector() { @NonNull @Override public List<Size> select(@NonNull List<Size> source) { Collections.sort(source); Collections.reverse(source); return source; } }; } }
SizeSelectors { @SuppressWarnings("WeakerAccess") @NonNull public static SizeSelector biggest() { return new SizeSelector() { @NonNull @Override public List<Size> select(@NonNull List<Size> source) { Collections.sort(source); Collections.reverse(source); return source; } }; } @SuppressWarnings("WeakerAccess") @NonNull...
SizeSelectors { @SuppressWarnings("WeakerAccess") @NonNull public static SizeSelector biggest() { return new SizeSelector() { @NonNull @Override public List<Size> select(@NonNull List<Size> source) { Collections.sort(source); Collections.reverse(source); return source; } }; } @SuppressWarnings("WeakerAccess") @NonNull...
@Test public void testMin() { SizeSelector selector = SizeSelectors.smallest(); List<Size> list = selector.select(input); assertEquals(list.size(), input.size()); assertTrue(list.get(0).equals(new Size(30, 40)) || list.get(0).equals(new Size(40, 30))); }
@SuppressWarnings("WeakerAccess") @NonNull public static SizeSelector smallest() { return new SizeSelector() { @NonNull @Override public List<Size> select(@NonNull List<Size> source) { Collections.sort(source); return source; } }; }
SizeSelectors { @SuppressWarnings("WeakerAccess") @NonNull public static SizeSelector smallest() { return new SizeSelector() { @NonNull @Override public List<Size> select(@NonNull List<Size> source) { Collections.sort(source); return source; } }; } }
SizeSelectors { @SuppressWarnings("WeakerAccess") @NonNull public static SizeSelector smallest() { return new SizeSelector() { @NonNull @Override public List<Size> select(@NonNull List<Size> source) { Collections.sort(source); return source; } }; } }
SizeSelectors { @SuppressWarnings("WeakerAccess") @NonNull public static SizeSelector smallest() { return new SizeSelector() { @NonNull @Override public List<Size> select(@NonNull List<Size> source) { Collections.sort(source); return source; } }; } @SuppressWarnings("WeakerAccess") @NonNull static SizeSelector withFil...
SizeSelectors { @SuppressWarnings("WeakerAccess") @NonNull public static SizeSelector smallest() { return new SizeSelector() { @NonNull @Override public List<Size> select(@NonNull List<Size> source) { Collections.sort(source); return source; } }; } @SuppressWarnings("WeakerAccess") @NonNull static SizeSelector withFil...
@Test public void testMaxArea() { SizeSelector selector = SizeSelectors.maxArea(100 * 100); List<Size> list = selector.select(input); assertEquals(list.size(), 2); assertEquals(list.get(0), new Size(30, 40)); assertEquals(list.get(1), new Size(40, 30)); }
@NonNull @SuppressWarnings("WeakerAccess") public static SizeSelector maxArea(final int area) { return withFilter(new Filter() { @Override public boolean accepts(@NonNull Size size) { return size.getHeight() * size.getWidth() <= area; } }); }
SizeSelectors { @NonNull @SuppressWarnings("WeakerAccess") public static SizeSelector maxArea(final int area) { return withFilter(new Filter() { @Override public boolean accepts(@NonNull Size size) { return size.getHeight() * size.getWidth() <= area; } }); } }
SizeSelectors { @NonNull @SuppressWarnings("WeakerAccess") public static SizeSelector maxArea(final int area) { return withFilter(new Filter() { @Override public boolean accepts(@NonNull Size size) { return size.getHeight() * size.getWidth() <= area; } }); } }
SizeSelectors { @NonNull @SuppressWarnings("WeakerAccess") public static SizeSelector maxArea(final int area) { return withFilter(new Filter() { @Override public boolean accepts(@NonNull Size size) { return size.getHeight() * size.getWidth() <= area; } }); } @SuppressWarnings("WeakerAccess") @NonNull static SizeSelect...
SizeSelectors { @NonNull @SuppressWarnings("WeakerAccess") public static SizeSelector maxArea(final int area) { return withFilter(new Filter() { @Override public boolean accepts(@NonNull Size size) { return size.getHeight() * size.getWidth() <= area; } }); } @SuppressWarnings("WeakerAccess") @NonNull static SizeSelect...
@Test public void testMinArea() { SizeSelector selector = SizeSelectors.minArea(1000 * 1000); List<Size> list = selector.select(input); assertEquals(list.size(), 2); assertEquals(list.get(0), new Size(1600, 900)); assertEquals(list.get(1), new Size(2000, 4000)); }
@SuppressWarnings("WeakerAccess") @NonNull public static SizeSelector minArea(final int area) { return withFilter(new Filter() { @Override public boolean accepts(@NonNull Size size) { return size.getHeight() * size.getWidth() >= area; } }); }
SizeSelectors { @SuppressWarnings("WeakerAccess") @NonNull public static SizeSelector minArea(final int area) { return withFilter(new Filter() { @Override public boolean accepts(@NonNull Size size) { return size.getHeight() * size.getWidth() >= area; } }); } }
SizeSelectors { @SuppressWarnings("WeakerAccess") @NonNull public static SizeSelector minArea(final int area) { return withFilter(new Filter() { @Override public boolean accepts(@NonNull Size size) { return size.getHeight() * size.getWidth() >= area; } }); } }
SizeSelectors { @SuppressWarnings("WeakerAccess") @NonNull public static SizeSelector minArea(final int area) { return withFilter(new Filter() { @Override public boolean accepts(@NonNull Size size) { return size.getHeight() * size.getWidth() >= area; } }); } @SuppressWarnings("WeakerAccess") @NonNull static SizeSelect...
SizeSelectors { @SuppressWarnings("WeakerAccess") @NonNull public static SizeSelector minArea(final int area) { return withFilter(new Filter() { @Override public boolean accepts(@NonNull Size size) { return size.getHeight() * size.getWidth() >= area; } }); } @SuppressWarnings("WeakerAccess") @NonNull static SizeSelect...
@Test public void testAnd() { SizeSelector selector = SizeSelectors.and( SizeSelectors.aspectRatio(AspectRatio.of(1, 2), 0), SizeSelectors.maxWidth(100) ); List<Size> list = selector.select(input); assertEquals(list.size(), 1); assertEquals(list.get(0), new Size(100, 200)); }
@NonNull public static SizeSelector and(SizeSelector... selectors) { return new AndSelector(selectors); }
SizeSelectors { @NonNull public static SizeSelector and(SizeSelector... selectors) { return new AndSelector(selectors); } }
SizeSelectors { @NonNull public static SizeSelector and(SizeSelector... selectors) { return new AndSelector(selectors); } }
SizeSelectors { @NonNull public static SizeSelector and(SizeSelector... selectors) { return new AndSelector(selectors); } @SuppressWarnings("WeakerAccess") @NonNull static SizeSelector withFilter(@NonNull Filter filter); @NonNull static SizeSelector maxWidth(final int width); @NonNull static SizeSelector minWidth(fina...
SizeSelectors { @NonNull public static SizeSelector and(SizeSelector... selectors) { return new AndSelector(selectors); } @SuppressWarnings("WeakerAccess") @NonNull static SizeSelector withFilter(@NonNull Filter filter); @NonNull static SizeSelector maxWidth(final int width); @NonNull static SizeSelector minWidth(fina...
@Test(expected = IllegalStateException.class) public void testSetSensorOffset_throws() { angles.setSensorOffset(Facing.BACK, 135); }
public void setSensorOffset(@NonNull Facing sensorFacing, int sensorOffset) { sanitizeInput(sensorOffset); mSensorFacing = sensorFacing; mSensorOffset = sensorOffset; if (mSensorFacing == Facing.FRONT) { mSensorOffset = sanitizeOutput(360 - mSensorOffset); } print(); }
Angles { public void setSensorOffset(@NonNull Facing sensorFacing, int sensorOffset) { sanitizeInput(sensorOffset); mSensorFacing = sensorFacing; mSensorOffset = sensorOffset; if (mSensorFacing == Facing.FRONT) { mSensorOffset = sanitizeOutput(360 - mSensorOffset); } print(); } }
Angles { public void setSensorOffset(@NonNull Facing sensorFacing, int sensorOffset) { sanitizeInput(sensorOffset); mSensorFacing = sensorFacing; mSensorOffset = sensorOffset; if (mSensorFacing == Facing.FRONT) { mSensorOffset = sanitizeOutput(360 - mSensorOffset); } print(); } }
Angles { public void setSensorOffset(@NonNull Facing sensorFacing, int sensorOffset) { sanitizeInput(sensorOffset); mSensorFacing = sensorFacing; mSensorOffset = sensorOffset; if (mSensorFacing == Facing.FRONT) { mSensorOffset = sanitizeOutput(360 - mSensorOffset); } print(); } void setSensorOffset(@NonNull Facing sen...
Angles { public void setSensorOffset(@NonNull Facing sensorFacing, int sensorOffset) { sanitizeInput(sensorOffset); mSensorFacing = sensorFacing; mSensorOffset = sensorOffset; if (mSensorFacing == Facing.FRONT) { mSensorOffset = sanitizeOutput(360 - mSensorOffset); } print(); } void setSensorOffset(@NonNull Facing sen...
@Test(expected = IllegalStateException.class) public void testSetDisplayOffset_throws() { angles.setDisplayOffset(135); }
public void setDisplayOffset(int displayOffset) { sanitizeInput(displayOffset); mDisplayOffset = displayOffset; print(); }
Angles { public void setDisplayOffset(int displayOffset) { sanitizeInput(displayOffset); mDisplayOffset = displayOffset; print(); } }
Angles { public void setDisplayOffset(int displayOffset) { sanitizeInput(displayOffset); mDisplayOffset = displayOffset; print(); } }
Angles { public void setDisplayOffset(int displayOffset) { sanitizeInput(displayOffset); mDisplayOffset = displayOffset; print(); } void setSensorOffset(@NonNull Facing sensorFacing, int sensorOffset); void setDisplayOffset(int displayOffset); void setDeviceOrientation(int deviceOrientation); int offset(@NonNull Refer...
Angles { public void setDisplayOffset(int displayOffset) { sanitizeInput(displayOffset); mDisplayOffset = displayOffset; print(); } void setSensorOffset(@NonNull Facing sensorFacing, int sensorOffset); void setDisplayOffset(int displayOffset); void setDeviceOrientation(int deviceOrientation); int offset(@NonNull Refer...
@Test(expected = IllegalStateException.class) public void testSetDeviceOrientation_throws() { angles.setDeviceOrientation(135); }
public void setDeviceOrientation(int deviceOrientation) { sanitizeInput(deviceOrientation); mDeviceOrientation = deviceOrientation; print(); }
Angles { public void setDeviceOrientation(int deviceOrientation) { sanitizeInput(deviceOrientation); mDeviceOrientation = deviceOrientation; print(); } }
Angles { public void setDeviceOrientation(int deviceOrientation) { sanitizeInput(deviceOrientation); mDeviceOrientation = deviceOrientation; print(); } }
Angles { public void setDeviceOrientation(int deviceOrientation) { sanitizeInput(deviceOrientation); mDeviceOrientation = deviceOrientation; print(); } void setSensorOffset(@NonNull Facing sensorFacing, int sensorOffset); void setDisplayOffset(int displayOffset); void setDeviceOrientation(int deviceOrientation); int o...
Angles { public void setDeviceOrientation(int deviceOrientation) { sanitizeInput(deviceOrientation); mDeviceOrientation = deviceOrientation; print(); } void setSensorOffset(@NonNull Facing sensorFacing, int sensorOffset); void setDisplayOffset(int displayOffset); void setDeviceOrientation(int deviceOrientation); int o...
@Test public void testValues() { assertEquals(0, ExifHelper.getOrientation(ExifInterface.ORIENTATION_NORMAL)); assertEquals(0, ExifHelper.getOrientation(ExifInterface.ORIENTATION_FLIP_HORIZONTAL)); assertEquals(180, ExifHelper.getOrientation(ExifInterface.ORIENTATION_ROTATE_180)); assertEquals(180, ExifHelper.getOrient...
public static int getOrientation(int exifOrientation) { int orientation; switch (exifOrientation) { case ExifInterface.ORIENTATION_NORMAL: case ExifInterface.ORIENTATION_FLIP_HORIZONTAL: orientation = 0; break; case ExifInterface.ORIENTATION_ROTATE_180: case ExifInterface.ORIENTATION_FLIP_VERTICAL: orientation = 180; b...
ExifHelper { public static int getOrientation(int exifOrientation) { int orientation; switch (exifOrientation) { case ExifInterface.ORIENTATION_NORMAL: case ExifInterface.ORIENTATION_FLIP_HORIZONTAL: orientation = 0; break; case ExifInterface.ORIENTATION_ROTATE_180: case ExifInterface.ORIENTATION_FLIP_VERTICAL: orienta...
ExifHelper { public static int getOrientation(int exifOrientation) { int orientation; switch (exifOrientation) { case ExifInterface.ORIENTATION_NORMAL: case ExifInterface.ORIENTATION_FLIP_HORIZONTAL: orientation = 0; break; case ExifInterface.ORIENTATION_ROTATE_180: case ExifInterface.ORIENTATION_FLIP_VERTICAL: orienta...
ExifHelper { public static int getOrientation(int exifOrientation) { int orientation; switch (exifOrientation) { case ExifInterface.ORIENTATION_NORMAL: case ExifInterface.ORIENTATION_FLIP_HORIZONTAL: orientation = 0; break; case ExifInterface.ORIENTATION_ROTATE_180: case ExifInterface.ORIENTATION_FLIP_VERTICAL: orienta...
ExifHelper { public static int getOrientation(int exifOrientation) { int orientation; switch (exifOrientation) { case ExifInterface.ORIENTATION_NORMAL: case ExifInterface.ORIENTATION_FLIP_HORIZONTAL: orientation = 0; break; case ExifInterface.ORIENTATION_ROTATE_180: case ExifInterface.ORIENTATION_FLIP_VERTICAL: orienta...
@Test public void testUnknownValues() { assertEquals(0, ExifHelper.getOrientation(-15)); assertEquals(0, ExifHelper.getOrientation(-1)); assertEquals(0, ExifHelper.getOrientation(195)); assertEquals(0, ExifHelper.getOrientation(Integer.MAX_VALUE)); }
public static int getOrientation(int exifOrientation) { int orientation; switch (exifOrientation) { case ExifInterface.ORIENTATION_NORMAL: case ExifInterface.ORIENTATION_FLIP_HORIZONTAL: orientation = 0; break; case ExifInterface.ORIENTATION_ROTATE_180: case ExifInterface.ORIENTATION_FLIP_VERTICAL: orientation = 180; b...
ExifHelper { public static int getOrientation(int exifOrientation) { int orientation; switch (exifOrientation) { case ExifInterface.ORIENTATION_NORMAL: case ExifInterface.ORIENTATION_FLIP_HORIZONTAL: orientation = 0; break; case ExifInterface.ORIENTATION_ROTATE_180: case ExifInterface.ORIENTATION_FLIP_VERTICAL: orienta...
ExifHelper { public static int getOrientation(int exifOrientation) { int orientation; switch (exifOrientation) { case ExifInterface.ORIENTATION_NORMAL: case ExifInterface.ORIENTATION_FLIP_HORIZONTAL: orientation = 0; break; case ExifInterface.ORIENTATION_ROTATE_180: case ExifInterface.ORIENTATION_FLIP_VERTICAL: orienta...
ExifHelper { public static int getOrientation(int exifOrientation) { int orientation; switch (exifOrientation) { case ExifInterface.ORIENTATION_NORMAL: case ExifInterface.ORIENTATION_FLIP_HORIZONTAL: orientation = 0; break; case ExifInterface.ORIENTATION_ROTATE_180: case ExifInterface.ORIENTATION_FLIP_VERTICAL: orienta...
ExifHelper { public static int getOrientation(int exifOrientation) { int orientation; switch (exifOrientation) { case ExifInterface.ORIENTATION_NORMAL: case ExifInterface.ORIENTATION_FLIP_HORIZONTAL: orientation = 0; break; case ExifInterface.ORIENTATION_ROTATE_180: case ExifInterface.ORIENTATION_FLIP_VERTICAL: orienta...
@Test public void testInstances() { for (int i = 0; i < MAX_SIZE; i++) { assertEquals(instances, i); pool.get(); } }
@Nullable public T get() { synchronized (lock) { T item = queue.poll(); if (item != null) { activeCount++; LOG.v("GET - Reusing recycled item.", this); return item; } if (isEmpty()) { LOG.v("GET - Returning null. Too much items requested.", this); return null; } activeCount++; LOG.v("GET - Creating a new item.", this);...
Pool { @Nullable public T get() { synchronized (lock) { T item = queue.poll(); if (item != null) { activeCount++; LOG.v("GET - Reusing recycled item.", this); return item; } if (isEmpty()) { LOG.v("GET - Returning null. Too much items requested.", this); return null; } activeCount++; LOG.v("GET - Creating a new item.",...
Pool { @Nullable public T get() { synchronized (lock) { T item = queue.poll(); if (item != null) { activeCount++; LOG.v("GET - Reusing recycled item.", this); return item; } if (isEmpty()) { LOG.v("GET - Returning null. Too much items requested.", this); return null; } activeCount++; LOG.v("GET - Creating a new item.",...
Pool { @Nullable public T get() { synchronized (lock) { T item = queue.poll(); if (item != null) { activeCount++; LOG.v("GET - Reusing recycled item.", this); return item; } if (isEmpty()) { LOG.v("GET - Returning null. Too much items requested.", this); return null; } activeCount++; LOG.v("GET - Creating a new item.",...
Pool { @Nullable public T get() { synchronized (lock) { T item = queue.poll(); if (item != null) { activeCount++; LOG.v("GET - Reusing recycled item.", this); return item; } if (isEmpty()) { LOG.v("GET - Returning null. Too much items requested.", this); return null; } activeCount++; LOG.v("GET - Creating a new item.",...
@Test public void testClear() { Item item = pool.get(); assertNotNull(item); pool.recycle(item); assertEquals(pool.recycledCount(), 1); assertEquals(pool.activeCount(), 0); assertEquals(pool.count(), 1); pool.clear(); assertEquals(pool.recycledCount(), 0); assertEquals(pool.activeCount(), 0); assertEquals(pool.count(),...
@CallSuper public void clear() { synchronized (lock) { queue.clear(); } }
Pool { @CallSuper public void clear() { synchronized (lock) { queue.clear(); } } }
Pool { @CallSuper public void clear() { synchronized (lock) { queue.clear(); } } Pool(int maxPoolSize, @NonNull Factory<T> factory); }
Pool { @CallSuper public void clear() { synchronized (lock) { queue.clear(); } } Pool(int maxPoolSize, @NonNull Factory<T> factory); boolean isEmpty(); @Nullable T get(); void recycle(@NonNull T item); @CallSuper void clear(); final int count(); @SuppressWarnings("WeakerAccess") final int activeCount(); @SuppressWarnin...
Pool { @CallSuper public void clear() { synchronized (lock) { queue.clear(); } } Pool(int maxPoolSize, @NonNull Factory<T> factory); boolean isEmpty(); @Nullable T get(); void recycle(@NonNull T item); @CallSuper void clear(); final int count(); @SuppressWarnings("WeakerAccess") final int activeCount(); @SuppressWarnin...
@Test public void invokerStrategy() throws InterruptedException { SchedulingStrategy strategy = SchedulingStrategies.createInvokerStrategy( new Logger() ); assertFalse( strategy.hasSharedThreadPool() ); assertTrue( strategy.canSchedule() ); Task task = new Task(); strategy.schedule( task ); assertTrue( strategy.canSche...
public static SchedulingStrategy createInvokerStrategy( ConsoleLogger logger ) { return new InvokerStrategy( logger ); }
SchedulingStrategies { public static SchedulingStrategy createInvokerStrategy( ConsoleLogger logger ) { return new InvokerStrategy( logger ); } }
SchedulingStrategies { public static SchedulingStrategy createInvokerStrategy( ConsoleLogger logger ) { return new InvokerStrategy( logger ); } }
SchedulingStrategies { public static SchedulingStrategy createInvokerStrategy( ConsoleLogger logger ) { return new InvokerStrategy( logger ); } static SchedulingStrategy createInvokerStrategy( ConsoleLogger logger ); static SchedulingStrategy createParallelStrategy( ConsoleLogger logger, int nThreads ); static Schedul...
SchedulingStrategies { public static SchedulingStrategy createInvokerStrategy( ConsoleLogger logger ) { return new InvokerStrategy( logger ); } static SchedulingStrategy createInvokerStrategy( ConsoleLogger logger ); static SchedulingStrategy createParallelStrategy( ConsoleLogger logger, int nThreads ); static Schedul...
@Test public void optimizationParameter() { assertFalse( newTestSetOptimization( false ).isParallelOptimization() ); }
public boolean isParallelOptimization() { return parallelOptimization; }
JUnitCoreParameters { public boolean isParallelOptimization() { return parallelOptimization; } }
JUnitCoreParameters { public boolean isParallelOptimization() { return parallelOptimization; } JUnitCoreParameters( Map<String, String> properties ); }
JUnitCoreParameters { public boolean isParallelOptimization() { return parallelOptimization; } JUnitCoreParameters( Map<String, String> properties ); boolean isParallelMethods(); boolean isParallelClasses(); boolean isParallelSuites(); @Deprecated @SuppressWarnings( { "unused", "deprecation" } ) boolean isParallelBoth(...
JUnitCoreParameters { public boolean isParallelOptimization() { return parallelOptimization; } JUnitCoreParameters( Map<String, String> properties ); boolean isParallelMethods(); boolean isParallelClasses(); boolean isParallelSuites(); @Deprecated @SuppressWarnings( { "unused", "deprecation" } ) boolean isParallelBoth(...
@Test public void isParallelMethod() { assertFalse( newTestSetClasses().isParallelMethods() ); assertTrue( newTestSetMethods().isParallelMethods() ); assertTrue( newTestSetBoth().isParallelMethods() ); }
public boolean isParallelMethods() { return isAllParallel() || lowerCase( "both", "methods", "suitesAndMethods", "classesAndMethods" ).contains( parallel ); }
JUnitCoreParameters { public boolean isParallelMethods() { return isAllParallel() || lowerCase( "both", "methods", "suitesAndMethods", "classesAndMethods" ).contains( parallel ); } }
JUnitCoreParameters { public boolean isParallelMethods() { return isAllParallel() || lowerCase( "both", "methods", "suitesAndMethods", "classesAndMethods" ).contains( parallel ); } JUnitCoreParameters( Map<String, String> properties ); }
JUnitCoreParameters { public boolean isParallelMethods() { return isAllParallel() || lowerCase( "both", "methods", "suitesAndMethods", "classesAndMethods" ).contains( parallel ); } JUnitCoreParameters( Map<String, String> properties ); boolean isParallelMethods(); boolean isParallelClasses(); boolean isParallelSuites()...
JUnitCoreParameters { public boolean isParallelMethods() { return isAllParallel() || lowerCase( "both", "methods", "suitesAndMethods", "classesAndMethods" ).contains( parallel ); } JUnitCoreParameters( Map<String, String> properties ); boolean isParallelMethods(); boolean isParallelClasses(); boolean isParallelSuites()...
@Test public void isParallelClasses() { assertTrue( newTestSetClasses().isParallelClasses() ); assertFalse( newTestSetMethods().isParallelClasses() ); assertTrue( newTestSetBoth().isParallelClasses() ); }
public boolean isParallelClasses() { return isAllParallel() || lowerCase( "both", "classes", "suitesAndClasses", "classesAndMethods" ).contains( parallel ); }
JUnitCoreParameters { public boolean isParallelClasses() { return isAllParallel() || lowerCase( "both", "classes", "suitesAndClasses", "classesAndMethods" ).contains( parallel ); } }
JUnitCoreParameters { public boolean isParallelClasses() { return isAllParallel() || lowerCase( "both", "classes", "suitesAndClasses", "classesAndMethods" ).contains( parallel ); } JUnitCoreParameters( Map<String, String> properties ); }
JUnitCoreParameters { public boolean isParallelClasses() { return isAllParallel() || lowerCase( "both", "classes", "suitesAndClasses", "classesAndMethods" ).contains( parallel ); } JUnitCoreParameters( Map<String, String> properties ); boolean isParallelMethods(); boolean isParallelClasses(); boolean isParallelSuites()...
JUnitCoreParameters { public boolean isParallelClasses() { return isAllParallel() || lowerCase( "both", "classes", "suitesAndClasses", "classesAndMethods" ).contains( parallel ); } JUnitCoreParameters( Map<String, String> properties ); boolean isParallelMethods(); boolean isParallelClasses(); boolean isParallelSuites()...
@Test public void isParallelBoth() { assertFalse( isParallelMethodsAndClasses( newTestSetClasses() ) ); assertFalse( isParallelMethodsAndClasses( newTestSetMethods() ) ); assertTrue( isParallelMethodsAndClasses( newTestSetBoth() ) ); }
@Deprecated @SuppressWarnings( { "unused", "deprecation" } ) public boolean isParallelBoth() { return isParallelMethods() && isParallelClasses(); }
JUnitCoreParameters { @Deprecated @SuppressWarnings( { "unused", "deprecation" } ) public boolean isParallelBoth() { return isParallelMethods() && isParallelClasses(); } }
JUnitCoreParameters { @Deprecated @SuppressWarnings( { "unused", "deprecation" } ) public boolean isParallelBoth() { return isParallelMethods() && isParallelClasses(); } JUnitCoreParameters( Map<String, String> properties ); }
JUnitCoreParameters { @Deprecated @SuppressWarnings( { "unused", "deprecation" } ) public boolean isParallelBoth() { return isParallelMethods() && isParallelClasses(); } JUnitCoreParameters( Map<String, String> properties ); boolean isParallelMethods(); boolean isParallelClasses(); boolean isParallelSuites(); @Deprecat...
JUnitCoreParameters { @Deprecated @SuppressWarnings( { "unused", "deprecation" } ) public boolean isParallelBoth() { return isParallelMethods() && isParallelClasses(); } JUnitCoreParameters( Map<String, String> properties ); boolean isParallelMethods(); boolean isParallelClasses(); boolean isParallelSuites(); @Deprecat...
@Test public void nonSharedPoolStrategy() throws InterruptedException { SchedulingStrategy strategy = SchedulingStrategies.createParallelStrategy( new Logger(), 2 ); assertFalse( strategy.hasSharedThreadPool() ); assertTrue( strategy.canSchedule() ); Task task1 = new Task(); Task task2 = new Task(); strategy.schedule( ...
public static SchedulingStrategy createParallelStrategy( ConsoleLogger logger, int nThreads ) { return new NonSharedThreadPoolStrategy( logger, Executors.newFixedThreadPool( nThreads, DAEMON_THREAD_FACTORY ) ); }
SchedulingStrategies { public static SchedulingStrategy createParallelStrategy( ConsoleLogger logger, int nThreads ) { return new NonSharedThreadPoolStrategy( logger, Executors.newFixedThreadPool( nThreads, DAEMON_THREAD_FACTORY ) ); } }
SchedulingStrategies { public static SchedulingStrategy createParallelStrategy( ConsoleLogger logger, int nThreads ) { return new NonSharedThreadPoolStrategy( logger, Executors.newFixedThreadPool( nThreads, DAEMON_THREAD_FACTORY ) ); } }
SchedulingStrategies { public static SchedulingStrategy createParallelStrategy( ConsoleLogger logger, int nThreads ) { return new NonSharedThreadPoolStrategy( logger, Executors.newFixedThreadPool( nThreads, DAEMON_THREAD_FACTORY ) ); } static SchedulingStrategy createInvokerStrategy( ConsoleLogger logger ); static Sch...
SchedulingStrategies { public static SchedulingStrategy createParallelStrategy( ConsoleLogger logger, int nThreads ) { return new NonSharedThreadPoolStrategy( logger, Executors.newFixedThreadPool( nThreads, DAEMON_THREAD_FACTORY ) ); } static SchedulingStrategy createInvokerStrategy( ConsoleLogger logger ); static Sch...
@Test public void isPerCoreThreadCount() { assertFalse( newTestSetClasses().isPerCoreThreadCount() ); assertFalse( newTestSetMethods().isPerCoreThreadCount() ); assertTrue( newTestSetBoth().isPerCoreThreadCount() ); }
public boolean isPerCoreThreadCount() { return perCoreThreadCount; }
JUnitCoreParameters { public boolean isPerCoreThreadCount() { return perCoreThreadCount; } }
JUnitCoreParameters { public boolean isPerCoreThreadCount() { return perCoreThreadCount; } JUnitCoreParameters( Map<String, String> properties ); }
JUnitCoreParameters { public boolean isPerCoreThreadCount() { return perCoreThreadCount; } JUnitCoreParameters( Map<String, String> properties ); boolean isParallelMethods(); boolean isParallelClasses(); boolean isParallelSuites(); @Deprecated @SuppressWarnings( { "unused", "deprecation" } ) boolean isParallelBoth(); b...
JUnitCoreParameters { public boolean isPerCoreThreadCount() { return perCoreThreadCount; } JUnitCoreParameters( Map<String, String> properties ); boolean isParallelMethods(); boolean isParallelClasses(); boolean isParallelSuites(); @Deprecated @SuppressWarnings( { "unused", "deprecation" } ) boolean isParallelBoth(); b...
@Test public void getThreadCount() { assertFalse( newTestSetClasses().isPerCoreThreadCount() ); assertFalse( newTestSetMethods().isPerCoreThreadCount() ); assertTrue( newTestSetBoth().isPerCoreThreadCount() ); }
public int getThreadCount() { return threadCount; }
JUnitCoreParameters { public int getThreadCount() { return threadCount; } }
JUnitCoreParameters { public int getThreadCount() { return threadCount; } JUnitCoreParameters( Map<String, String> properties ); }
JUnitCoreParameters { public int getThreadCount() { return threadCount; } JUnitCoreParameters( Map<String, String> properties ); boolean isParallelMethods(); boolean isParallelClasses(); boolean isParallelSuites(); @Deprecated @SuppressWarnings( { "unused", "deprecation" } ) boolean isParallelBoth(); boolean isPerCoreT...
JUnitCoreParameters { public int getThreadCount() { return threadCount; } JUnitCoreParameters( Map<String, String> properties ); boolean isParallelMethods(); boolean isParallelClasses(); boolean isParallelSuites(); @Deprecated @SuppressWarnings( { "unused", "deprecation" } ) boolean isParallelBoth(); boolean isPerCoreT...
@Test public void isUseUnlimitedThreads() { assertFalse( newTestSetClasses().isUseUnlimitedThreads() ); assertTrue( newTestSetMethods().isUseUnlimitedThreads() ); assertFalse( newTestSetBoth().isUseUnlimitedThreads() ); }
public boolean isUseUnlimitedThreads() { return useUnlimitedThreads; }
JUnitCoreParameters { public boolean isUseUnlimitedThreads() { return useUnlimitedThreads; } }
JUnitCoreParameters { public boolean isUseUnlimitedThreads() { return useUnlimitedThreads; } JUnitCoreParameters( Map<String, String> properties ); }
JUnitCoreParameters { public boolean isUseUnlimitedThreads() { return useUnlimitedThreads; } JUnitCoreParameters( Map<String, String> properties ); boolean isParallelMethods(); boolean isParallelClasses(); boolean isParallelSuites(); @Deprecated @SuppressWarnings( { "unused", "deprecation" } ) boolean isParallelBoth();...
JUnitCoreParameters { public boolean isUseUnlimitedThreads() { return useUnlimitedThreads; } JUnitCoreParameters( Map<String, String> properties ); boolean isParallelMethods(); boolean isParallelClasses(); boolean isParallelSuites(); @Deprecated @SuppressWarnings( { "unused", "deprecation" } ) boolean isParallelBoth();...
@Test public void isNoThreading() { assertFalse( newTestSetClasses().isNoThreading() ); assertFalse( newTestSetMethods().isNoThreading() ); assertFalse( newTestSetBoth().isNoThreading() ); }
public boolean isNoThreading() { return !isParallelismSelected(); }
JUnitCoreParameters { public boolean isNoThreading() { return !isParallelismSelected(); } }
JUnitCoreParameters { public boolean isNoThreading() { return !isParallelismSelected(); } JUnitCoreParameters( Map<String, String> properties ); }
JUnitCoreParameters { public boolean isNoThreading() { return !isParallelismSelected(); } JUnitCoreParameters( Map<String, String> properties ); boolean isParallelMethods(); boolean isParallelClasses(); boolean isParallelSuites(); @Deprecated @SuppressWarnings( { "unused", "deprecation" } ) boolean isParallelBoth(); bo...
JUnitCoreParameters { public boolean isNoThreading() { return !isParallelismSelected(); } JUnitCoreParameters( Map<String, String> properties ); boolean isParallelMethods(); boolean isParallelClasses(); boolean isParallelSuites(); @Deprecated @SuppressWarnings( { "unused", "deprecation" } ) boolean isParallelBoth(); bo...
@Test public void isAnyParallelismSelected() { assertTrue( newTestSetClasses().isParallelismSelected() ); assertTrue( newTestSetMethods().isParallelismSelected() ); assertTrue( newTestSetBoth().isParallelismSelected() ); }
public boolean isParallelismSelected() { return isParallelSuites() || isParallelClasses() || isParallelMethods(); }
JUnitCoreParameters { public boolean isParallelismSelected() { return isParallelSuites() || isParallelClasses() || isParallelMethods(); } }
JUnitCoreParameters { public boolean isParallelismSelected() { return isParallelSuites() || isParallelClasses() || isParallelMethods(); } JUnitCoreParameters( Map<String, String> properties ); }
JUnitCoreParameters { public boolean isParallelismSelected() { return isParallelSuites() || isParallelClasses() || isParallelMethods(); } JUnitCoreParameters( Map<String, String> properties ); boolean isParallelMethods(); boolean isParallelClasses(); boolean isParallelSuites(); @Deprecated @SuppressWarnings( { "unused"...
JUnitCoreParameters { public boolean isParallelismSelected() { return isParallelSuites() || isParallelClasses() || isParallelMethods(); } JUnitCoreParameters( Map<String, String> properties ); boolean isParallelMethods(); boolean isParallelClasses(); boolean isParallelSuites(); @Deprecated @SuppressWarnings( { "unused"...