Search in sources :

Example 11 with ProgrammingExercise

use of de.tum.in.www1.artemis.domain.ProgrammingExercise in project ArTEMiS by ls1intum.

the class ExerciseResourceIntTest method equalsVerifier.

@Test
@Transactional
public void equalsVerifier() throws Exception {
    TestUtil.equalsVerifier(Exercise.class);
    Exercise exercise1 = new ProgrammingExercise();
    exercise1.setId(1L);
    Exercise exercise2 = new ProgrammingExercise();
    exercise2.setId(exercise1.getId());
    assertThat(exercise1).isEqualTo(exercise2);
    exercise2.setId(2L);
    assertThat(exercise1).isNotEqualTo(exercise2);
    exercise1.setId(null);
    assertThat(exercise1).isNotEqualTo(exercise2);
}
Also used : ProgrammingExercise(de.tum.in.www1.artemis.domain.ProgrammingExercise) Exercise(de.tum.in.www1.artemis.domain.Exercise) ProgrammingExercise(de.tum.in.www1.artemis.domain.ProgrammingExercise) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Transactional(org.springframework.transaction.annotation.Transactional)

Example 12 with ProgrammingExercise

use of de.tum.in.www1.artemis.domain.ProgrammingExercise in project ArTEMiS by ls1intum.

the class ProgrammingExerciseResourceIntTest method createProgrammingExercise.

@Test
@Transactional
public void createProgrammingExercise() throws Exception {
    int databaseSizeBeforeCreate = programmingExerciseRepository.findAll().size();
    // Create the ProgrammingExercise
    restProgrammingExerciseMockMvc.perform(post("/api/programming-exercises").contentType(TestUtil.APPLICATION_JSON_UTF8).content(TestUtil.convertObjectToJsonBytes(programmingExercise))).andExpect(status().isCreated());
    // Validate the ProgrammingExercise in the database
    List<ProgrammingExercise> programmingExerciseList = programmingExerciseRepository.findAll();
    assertThat(programmingExerciseList).hasSize(databaseSizeBeforeCreate + 1);
    ProgrammingExercise testProgrammingExercise = programmingExerciseList.get(programmingExerciseList.size() - 1);
    assertThat(testProgrammingExercise.getBaseRepositoryUrl()).isEqualTo(DEFAULT_BASE_REPOSITORY_URL);
    assertThat(testProgrammingExercise.getBaseBuildPlanId()).isEqualTo(DEFAULT_BASE_BUILD_PLAN_ID);
    assertThat(testProgrammingExercise.isPublishBuildPlanUrl()).isEqualTo(DEFAULT_PUBLISH_BUILD_PLAN_URL);
    assertThat(testProgrammingExercise.isAllowOnlineEditor()).isEqualTo(DEFAULT_ALLOW_ONLINE_EDITOR);
}
Also used : ProgrammingExercise(de.tum.in.www1.artemis.domain.ProgrammingExercise) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Transactional(org.springframework.transaction.annotation.Transactional)

Example 13 with ProgrammingExercise

use of de.tum.in.www1.artemis.domain.ProgrammingExercise in project ArTEMiS by ls1intum.

the class ProgrammingExerciseResourceIntTest method equalsVerifier.

@Test
@Transactional
public void equalsVerifier() throws Exception {
    TestUtil.equalsVerifier(ProgrammingExercise.class);
    ProgrammingExercise programmingExercise1 = new ProgrammingExercise();
    programmingExercise1.setId(1L);
    ProgrammingExercise programmingExercise2 = new ProgrammingExercise();
    programmingExercise2.setId(programmingExercise1.getId());
    assertThat(programmingExercise1).isEqualTo(programmingExercise2);
    programmingExercise2.setId(2L);
    assertThat(programmingExercise1).isNotEqualTo(programmingExercise2);
    programmingExercise1.setId(null);
    assertThat(programmingExercise1).isNotEqualTo(programmingExercise2);
}
Also used : ProgrammingExercise(de.tum.in.www1.artemis.domain.ProgrammingExercise) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

ProgrammingExercise (de.tum.in.www1.artemis.domain.ProgrammingExercise)10 Timed (com.codahale.metrics.annotation.Timed)7 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)7 Transactional (org.springframework.transaction.annotation.Transactional)7 Course (de.tum.in.www1.artemis.domain.Course)6 User (de.tum.in.www1.artemis.domain.User)6 Test (org.junit.Test)4 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)4 ExerciseRepository (de.tum.in.www1.artemis.repository.ExerciseRepository)2 IOException (java.io.IOException)2 URI (java.net.URI)2 Path (java.nio.file.Path)2 GitAPIException (org.eclipse.jgit.api.errors.GitAPIException)2 Exercise (de.tum.in.www1.artemis.domain.Exercise)1 BambooException (de.tum.in.www1.artemis.exception.BambooException)1 BadRequestAlertException (de.tum.in.www1.artemis.web.rest.errors.BadRequestAlertException)1