Source:
<code>public void testGetBestSolution() throws Exception { assertSuccess( client.createContainer( CONTAINER_1_ID, new KieContainerResource( CONTAINER_1_ID, kjar1 ) ) ); assertSuccess( solverClient.createSolver( CONTAINER_1_ID, SOLVER_1_ID, SOLVER_1_CONFIG ) ); SolverInstance instance = new SolverInstance(); instance.setStatus( SolverInstance.SolverStatus.SOLVING ); instance.setPlanningProblem( loadPlanningProblem( 10, 30 ) ); ServiceResponse<SolverInstance> response = solverClient.updateSolverState( CONTAINER_1_ID, SOLVER_1_ID, instance ); assertSuccess( response ); assertEquals( SolverInstance.SolverStatus.SOLVING, response.getResult().getStatus() ); Solution solution = null; while (!Thread.currentThread().isInterrupted()) { ServiceResponse<SolverInstance> solutionResponse = solverClient.getSolverBestSolution(CONTAINER_1_ID, SOLVER_1_ID); assertSuccess(solutionResponse); solution = solutionResponse.getResult().getBestSolution(); if (solution != null && solution.getScore() != null && solution.getScore().isSolutionInitialized()) { break; } Thread.sleep(1000); } HardSoftScore score = (HardSoftScore) solution.getScore(); assertNotNull(score); assertTrue(solution.getScore().isSolutionInitialized()); assertTrue(score.getHardScore() <= 0); assertTrue(score.getHardScore() > -1000); assertTrue(score.getSoftScore() < 0); <START> assertTrue(score.getSoftScore() > -1000000); <END> List<?> computerList = (List<?>) valueOf(solution, "computerList"); assertEquals(10, computerList.size()); List<?> processList = (List<?>) valueOf(solution, "processList"); assertEquals(30, processList.size()); for(Object process : processList) { Object computer = valueOf(process, "computer"); assertNotNull(computer); assertTrue(computerList.contains(computer)); } assertSuccess( solverClient.disposeSolver( CONTAINER_1_ID, SOLVER_1_ID ) ); }</code><technical_language>I do 2 lines: guarantee initialized score -1k hard -1m soft. I retain original test</technical_language>

Target:
public void testGetBestSolution() throws Exception { assertSuccess( client.createContainer( CONTAINER_1_ID, new KieContainerResource( CONTAINER_1_ID, kjar1 ) ) ); assertSuccess( solverClient.createSolver( CONTAINER_1_ID, SOLVER_1_ID, SOLVER_1_CONFIG ) ); SolverInstance instance = new SolverInstance(); instance.setStatus( SolverInstance.SolverStatus.SOLVING ); instance.setPlanningProblem( loadPlanningProblem( 10, 30 ) ); ServiceResponse<SolverInstance> response = solverClient.updateSolverState( CONTAINER_1_ID, SOLVER_1_ID, instance ); assertSuccess( response ); assertEquals( SolverInstance.SolverStatus.SOLVING, response.getResult().getStatus() ); Solution solution = null; while (!Thread.currentThread().isInterrupted()) { ServiceResponse<SolverInstance> solutionResponse = solverClient.getSolverBestSolution(CONTAINER_1_ID, SOLVER_1_ID); assertSuccess(solutionResponse); solution = solutionResponse.getResult().getBestSolution(); if (solution != null && solution.getScore() != null && solution.getScore().isSolutionInitialized()) { break; } Thread.sleep(1000); } HardSoftScore score = (HardSoftScore) solution.getScore(); assertNotNull(score); assertTrue(solution.getScore().isSolutionInitialized()); assertTrue(score.getHardScore() <= 0); assertTrue(score.getSoftScore() < 0); List<?> computerList = (List<?>) valueOf(solution, "computerList"); assertEquals(10, computerList.size()); List<?> processList = (List<?>) valueOf(solution, "processList"); assertEquals(30, processList.size()); for(Object process : processList) { Object computer = valueOf(process, "computer"); assertNotNull(computer); assertTrue(computerList.contains(computer)); } assertSuccess( solverClient.disposeSolver( CONTAINER_1_ID, SOLVER_1_ID ) ); }