### Question:
IrmGPCM extends AbstractItemResponseModel { public double expectedValue(double theta){ double ev = 0; for(int i=0;i<ncat;i++){ ev += scoreWeight[i]*probability(theta, i); } return ev; } IrmGPCM(double discrimination, double[] step, double D); double probability(double theta, double[] iparam, int category, double D); double probability(double theta, int category); double expectedValue(double theta); double cumulativeProbability(double theta, int category); double[] gradient(double theta, int category); double[] gradient(double theta, double[] iparam, int k, double D); double derivTheta(double theta); double itemInformationAt(double theta); double[] nonZeroPrior(double[] param); void setDiscriminationPrior(ItemParamPrior prior); void setStepPriorAt(ItemParamPrior prior, int k); void setDifficultyPrior(ItemParamPrior difficultyPrior); void setGuessingPrior(ItemParamPrior guessingPrior); void setSlippingPrior(ItemParamPrior slippingPrior); double addPriorsToLogLikelihood(double ll, double[] iparam); double[] addPriorsToLogLikelihoodGradient(double[] loglikegrad, double[] iparam); void incrementMeanSigma(Mean mean, StandardDeviation sd); void incrementMeanMean(Mean meanDiscrimination, Mean meanDifficulty); void scale(double intercept, double slope); double tStarProbability(double theta, int category, double intercept, double slope); double tStarExpectedValue(double theta, double intercept, double slope); double tSharpProbability(double theta, int category, double intercept, double slope); double tSharpExpectedValue(double theta, double intercept, double slope); double[] getItemParameterArray(); void setStandardErrors(double[] x); IrmType getType(); int getNumberOfParameters(); int getNumberOfEstimatedParameters(); double getScalingConstant(); double getDifficulty(); void setDifficulty(double difficulty); double getProposalDifficulty(); void setProposalDifficulty(double difficulty); double getDifficultyStdError(); void setDifficultyStdError(double stdError); double getDiscrimination(); void setDiscrimination(double discrimination); void setProposalDiscrimination(double discrimination); double getDiscriminationStdError(); void setDiscriminationStdError(double stdError); double getGuessing(); void setGuessing(double guessing); void setProposalGuessing(double guessing); double getGuessingStdError(); void setGuessingStdError(double stdError); void setSlipping(double slipping); void setProposalSlipping(double slipping); void setSlippingStdError(double slipping); double getSlipping(); double getSlippingStdError(); double[] getStepParameters(); void setStepParameters(double[] step); void setProposalStepParameters(double[] step); double[] getStepStdError(); void setStepStdError(double[] stdError); double[] getThresholdParameters(); void setThresholdParameters(double[] thresholds); void setProposalThresholds(double[] thresholds); double[] getThresholdStdError(); void setThresholdStdError(double[] stdError); double acceptAllProposalValues(); String toString();  }### Answer:
@Test public void expectedValueTest1(){ System.out.println("Expected Value Test1"); IrmGPCM irm = new IrmGPCM(discrimination, step, 1.7); assertEquals("Expected value test 1", 1.67939, irm.expectedValue(0.0), 1e-5); }
@Test public void expectedValueTest2(){ System.out.println("Expected Value Test2"); IrmGPCM irm = new IrmGPCM(discrimination, step, 1.7); for(int i=0;i<theta1.length;i++){ assertEquals("Expected value test at theta: " + (i+1), ev[i], irm.expectedValue(theta1[i]), 1e-5); } }