Skip to content

Commit

Permalink
#706 updated unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Katzberg committed Sep 29, 2016
1 parent dfa4a8c commit fa734ce
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package eu.dzhw.fdz.metadatamanagement;

import org.junit.runner.RunWith;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
Expand All @@ -18,6 +19,7 @@
@SpringBootTest(classes = Application.class)
@ActiveProfiles(Constants.SPRING_PROFILE_UNITTEST)
@WebAppConfiguration
@AutoConfigureMockMvc
public abstract class AbstractTest {

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;

Expand Down Expand Up @@ -101,14 +100,9 @@ public void testCreateStudyWithWrongId() throws IOException, Exception {
study.setId("hurz");

// create the study with the given id
MvcResult result = mockMvc.perform(put(API_STUDY_URI + "/" + study.getId())
mockMvc.perform(put(API_STUDY_URI + "/" + study.getId())
.content(TestUtil.convertObjectToJsonBytes(study)))
.andExpect(status().is4xxClientError())
//TODO DKatzberg, why no reponse of this error?
//.andExpect(jsonPath("$.errors[0].message", containsString("study-management.error.study.id.not-equal-to-project-id")));
.andReturn();

System.out.println(result.getResponse().getContentAsString());
.andExpect(status().is4xxClientError());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;

Expand Down Expand Up @@ -296,15 +295,10 @@ public void testCreateVariableWithNonNumericValueOnContinouosScaleLevel() throws
validResponse.setValue("hurz");

// create the variable with duplicate value classes
MvcResult result = mockMvc.perform(put(API_VARIABLES_URI + "/" + variable.getId())
mockMvc.perform(put(API_VARIABLES_URI + "/" + variable.getId())
.content(TestUtil.convertObjectToJsonBytes(variable)))
.andExpect(status().is4xxClientError())
//TODO DKatzberg Why no Reponse of the Error by given Client Error?
// .andExpect(jsonPath("$.errors[0].message", containsString("variable-management.error.variable.valid-response-value-must-be-a-number-on-numeric-data-type")));
.andReturn();

System.out.println(result.getResponse().getContentAsString());

}

@Test
Expand Down

0 comments on commit fa734ce

Please sign in to comment.