use of de.tum.in.www1.artemis.domain.Result in project ArTEMiS by ls1intum.
the class ResultResourceIntTest method equalsVerifier.
@Test
@Transactional
public void equalsVerifier() throws Exception {
TestUtil.equalsVerifier(Result.class);
Result result1 = new Result();
result1.setId(1L);
Result result2 = new Result();
result2.setId(result1.getId());
assertThat(result1).isEqualTo(result2);
result2.setId(2L);
assertThat(result1).isNotEqualTo(result2);
result1.setId(null);
assertThat(result1).isNotEqualTo(result2);
}
use of de.tum.in.www1.artemis.domain.Result in project ArTEMiS by ls1intum.
the class ResultResourceIntTest method createResult.
@Test
@Transactional
public void createResult() throws Exception {
int databaseSizeBeforeCreate = resultRepository.findAll().size();
// Create the Result
restResultMockMvc.perform(post("/api/results").contentType(TestUtil.APPLICATION_JSON_UTF8).content(TestUtil.convertObjectToJsonBytes(result))).andExpect(status().isCreated());
// Validate the Result in the database
List<Result> resultList = resultRepository.findAll();
assertThat(resultList).hasSize(databaseSizeBeforeCreate + 1);
Result testResult = resultList.get(resultList.size() - 1);
assertThat(testResult.getResultString()).isEqualTo(DEFAULT_RESULT_STRING);
assertThat(testResult.getCompletionDate()).isEqualTo(DEFAULT_COMPLETION_DATE);
assertThat(testResult.isSuccessful()).isEqualTo(DEFAULT_SUCCESSFUL);
assertThat(testResult.isBuildArtifact()).isEqualTo(DEFAULT_BUILD_ARTIFACT);
assertThat(testResult.getScore()).isEqualTo(DEFAULT_SCORE);
assertThat(testResult.isRated()).isEqualTo(DEFAULT_RATED);
assertThat(testResult.getHasFeedback()).isEqualTo(DEFAULT_HAS_FEEDBACK);
}
use of de.tum.in.www1.artemis.domain.Result in project ArTEMiS by ls1intum.
the class LtiServiceIntTest method assertThatUnsuccessfulResultWithoutTextReturnsZeroScore.
@Test
public void assertThatUnsuccessfulResultWithoutTextReturnsZeroScore() {
Participation participation = new Participation();
participationRepository.save(participation);
Result result = new Result();
result.setParticipation(participation);
result.setSuccessful(false);
resultRepository.save(result);
// String score = ltiService.getScoreForParticipation(participation);
// assertThat(score).isEqualTo("0.00");
// cleanup
resultRepository.delete(result);
participationRepository.delete(participation);
}
use of de.tum.in.www1.artemis.domain.Result in project ArTEMiS by ls1intum.
the class LtiServiceIntTest method assertThatSuccessfulResultReturnsFullScore.
@Test
public void assertThatSuccessfulResultReturnsFullScore() {
Participation participation = new Participation();
participationRepository.save(participation);
Result result = new Result();
result.setParticipation(participation);
result.setSuccessful(true);
resultRepository.save(result);
// String score = ltiService.getScoreForParticipation(participation);
// assertThat(score).isEqualTo("1.00");
// cleanup
resultRepository.delete(result);
participationRepository.delete(participation);
}
use of de.tum.in.www1.artemis.domain.Result in project ArTEMiS by ls1intum.
the class LtiServiceIntTest method assertThatUnsuccessfulResultWith2of3FailedTestsReturnsCorrectScore.
@Test
public void assertThatUnsuccessfulResultWith2of3FailedTestsReturnsCorrectScore() {
Participation participation = new Participation();
participationRepository.save(participation);
Result result = new Result();
result.setParticipation(participation);
result.setSuccessful(false);
result.setResultString("2 of 3 failed");
resultRepository.save(result);
// String score = ltiService.getScoreForParticipation(participation);
// assertThat(score).isEqualTo("0.33");
// cleanup
resultRepository.delete(result);
participationRepository.delete(participation);
}
Aggregations