use of de.tum.in.www1.artemis.domain.Participation in project ArTEMiS by ls1intum.
the class LtiServiceIntTest method assertThatMultipleResultsReturnLatestScore.
@Test
public void assertThatMultipleResultsReturnLatestScore() {
Participation participation = new Participation();
participationRepository.save(participation);
Result oldResult = new Result();
oldResult.setParticipation(participation);
oldResult.setSuccessful(false);
oldResult.setCompletionDate(ZonedDateTime.now().minusHours(1));
oldResult.setResultString("2 of 4 failed");
resultRepository.save(oldResult);
Result result = new Result();
result.setParticipation(participation);
result.setSuccessful(false);
result.setCompletionDate(ZonedDateTime.now());
result.setResultString("1 of 4 failed");
resultRepository.save(result);
// String score = ltiService.getScoreForParticipation(participation);
// assertThat(score).isEqualTo("0.75");
// cleanup
resultRepository.delete(oldResult);
resultRepository.delete(result);
participationRepository.delete(participation);
}
use of de.tum.in.www1.artemis.domain.Participation in project ArTEMiS by ls1intum.
the class ParticipationResourceIntTest method createParticipation.
@Test
@Transactional
public void createParticipation() throws Exception {
int databaseSizeBeforeCreate = participationRepository.findAll().size();
// Create the Participation
restParticipationMockMvc.perform(post("/api/participations").contentType(TestUtil.APPLICATION_JSON_UTF8).content(TestUtil.convertObjectToJsonBytes(participation))).andExpect(status().isCreated());
// Validate the Participation in the database
List<Participation> participationList = participationRepository.findAll();
assertThat(participationList).hasSize(databaseSizeBeforeCreate + 1);
Participation testParticipation = participationList.get(participationList.size() - 1);
assertThat(testParticipation.getRepositoryUrl()).isEqualTo(DEFAULT_REPOSITORY_URL);
assertThat(testParticipation.getBuildPlanId()).isEqualTo(DEFAULT_BUILD_PLAN_ID);
assertThat(testParticipation.getInitializationState()).isEqualTo(DEFAULT_INITIALIZATION_STATE);
assertThat(testParticipation.getInitializationDate()).isEqualTo(DEFAULT_INITIALIZATION_DATE);
}
use of de.tum.in.www1.artemis.domain.Participation in project ArTEMiS by ls1intum.
the class ParticipationResourceIntTest method equalsVerifier.
@Test
@Transactional
public void equalsVerifier() throws Exception {
TestUtil.equalsVerifier(Participation.class);
Participation participation1 = new Participation();
participation1.setId(1L);
Participation participation2 = new Participation();
participation2.setId(participation1.getId());
assertThat(participation1).isEqualTo(participation2);
participation2.setId(2L);
assertThat(participation1).isNotEqualTo(participation2);
participation1.setId(null);
assertThat(participation1).isNotEqualTo(participation2);
}
use of de.tum.in.www1.artemis.domain.Participation in project ArTEMiS by ls1intum.
the class ParticipationResourceIntTest method updateParticipation.
@Test
@Transactional
public void updateParticipation() throws Exception {
// Initialize the database
participationService.save(participation);
int databaseSizeBeforeUpdate = participationRepository.findAll().size();
// Update the participation
Participation updatedParticipation = participationRepository.findOne(participation.getId());
updatedParticipation.repositoryUrl(UPDATED_REPOSITORY_URL).buildPlanId(UPDATED_BUILD_PLAN_ID).initializationState(UPDATED_INITIALIZATION_STATE).initializationDate(UPDATED_INITIALIZATION_DATE);
restParticipationMockMvc.perform(put("/api/participations").contentType(TestUtil.APPLICATION_JSON_UTF8).content(TestUtil.convertObjectToJsonBytes(updatedParticipation))).andExpect(status().isOk());
// Validate the Participation in the database
List<Participation> participationList = participationRepository.findAll();
assertThat(participationList).hasSize(databaseSizeBeforeUpdate);
Participation testParticipation = participationList.get(participationList.size() - 1);
assertThat(testParticipation.getRepositoryUrl()).isEqualTo(UPDATED_REPOSITORY_URL);
assertThat(testParticipation.getBuildPlanId()).isEqualTo(UPDATED_BUILD_PLAN_ID);
assertThat(testParticipation.getInitializationState()).isEqualTo(UPDATED_INITIALIZATION_STATE);
assertThat(testParticipation.getInitializationDate()).isEqualTo(UPDATED_INITIALIZATION_DATE);
}
Aggregations