Search in sources :

Example 1 with ReviewDecision

use of org.olat.modules.qpool.model.ReviewDecision in project OpenOLAT by OpenOLAT.

the class QuestionPoolServiceImplTest method shouldSetNewStatusOnlyIfChanged.

@Test
public void shouldSetNewStatusOnlyIfChanged() {
    QuestionStatus status = QuestionStatus.draft;
    item.setQuestionStatus(status);
    Float rating = new Float(RATING_FIVE);
    ReviewDecision decision = new ReviewDecision(false, QuestionStatus.finalVersion);
    when(reviewServiceMock.decideStatus(item, rating)).thenReturn(decision);
    sut.rateItemInReview(item, identityDummy, rating, null);
    assertThat(item.getQuestionStatus()).isEqualTo(status);
}
Also used : ReviewDecision(org.olat.modules.qpool.model.ReviewDecision) QuestionStatus(org.olat.modules.qpool.QuestionStatus) Test(org.junit.Test)

Example 2 with ReviewDecision

use of org.olat.modules.qpool.model.ReviewDecision in project OpenOLAT by OpenOLAT.

the class QuestionPoolServiceImplTest method shouldSaveRating.

@Test
public void shouldSaveRating() {
    when(reviewServiceMock.decideStatus(any(), any())).thenReturn(new ReviewDecision(false, null));
    sut.rateItemInReview(item, identityDummy, new Float(RATING_FIVE), null);
    verify(commentAndRatingServiceMock).createRating(identityDummy, item, null, RATING_FIVE);
}
Also used : ReviewDecision(org.olat.modules.qpool.model.ReviewDecision) Test(org.junit.Test)

Example 3 with ReviewDecision

use of org.olat.modules.qpool.model.ReviewDecision in project OpenOLAT by OpenOLAT.

the class QuestionPoolServiceImplTest method shouldSetNewStatusIfChanged.

@Test
public void shouldSetNewStatusIfChanged() {
    Float rating = new Float(RATING_FIVE);
    QuestionStatus status = QuestionStatus.finalVersion;
    ReviewDecision decision = new ReviewDecision(true, status);
    when(reviewServiceMock.decideStatus(item, rating)).thenReturn(decision);
    sut.rateItemInReview(item, identityDummy, rating, null);
    assertThat(item.getQuestionStatus()).isEqualTo(status);
}
Also used : ReviewDecision(org.olat.modules.qpool.model.ReviewDecision) QuestionStatus(org.olat.modules.qpool.QuestionStatus) Test(org.junit.Test)

Example 4 with ReviewDecision

use of org.olat.modules.qpool.model.ReviewDecision in project openolat by klemens.

the class QuestionPoolServiceImplTest method shouldSaveRating.

@Test
public void shouldSaveRating() {
    when(reviewServiceMock.decideStatus(any(), any())).thenReturn(new ReviewDecision(false, null));
    sut.rateItemInReview(item, identityDummy, new Float(RATING_FIVE), null);
    verify(commentAndRatingServiceMock).createRating(identityDummy, item, null, RATING_FIVE);
}
Also used : ReviewDecision(org.olat.modules.qpool.model.ReviewDecision) Test(org.junit.Test)

Example 5 with ReviewDecision

use of org.olat.modules.qpool.model.ReviewDecision in project openolat by klemens.

the class QuestionPoolServiceImplTest method shouldSetNewStatusOnlyIfChanged.

@Test
public void shouldSetNewStatusOnlyIfChanged() {
    QuestionStatus status = QuestionStatus.draft;
    item.setQuestionStatus(status);
    Float rating = new Float(RATING_FIVE);
    ReviewDecision decision = new ReviewDecision(false, QuestionStatus.finalVersion);
    when(reviewServiceMock.decideStatus(item, rating)).thenReturn(decision);
    sut.rateItemInReview(item, identityDummy, rating, null);
    assertThat(item.getQuestionStatus()).isEqualTo(status);
}
Also used : ReviewDecision(org.olat.modules.qpool.model.ReviewDecision) QuestionStatus(org.olat.modules.qpool.QuestionStatus) Test(org.junit.Test)

Aggregations

ReviewDecision (org.olat.modules.qpool.model.ReviewDecision)14 Test (org.junit.Test)12 QuestionStatus (org.olat.modules.qpool.QuestionStatus)4 QuestionItem (org.olat.modules.qpool.QuestionItem)2 QuestionItemAuditLogBuilder (org.olat.modules.qpool.QuestionItemAuditLogBuilder)2 QuestionItemImpl (org.olat.modules.qpool.model.QuestionItemImpl)2