Skip to content

Commit

Permalink
feat(app-test.yaml): testing github workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
neha-puraswani committed Oct 26, 2023
1 parent 1e4dc20 commit 3a50c6b
Showing 1 changed file with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
@ContextConfiguration(initializers = {ContainerContextInitializer.class})
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
class DataMasterControllerTest {

@Autowired
private AccessTypeMasterRepository accessTypeMasterRepository;
@Autowired
Expand All @@ -60,59 +60,59 @@ class DataMasterControllerTest {
private TestRestTemplate restTemplate;
@Autowired
private ObjectMapper mapper;

@MockBean
@Autowired
private PolicyService policyService;

@Test
void fetch_access_master_200() {
final String type = "access";
this.request_master_data(this.accessTypeMasterRepository.count(), type);
}

@Test
void fetch_entity_master_200() {
final String type = "entity";
this.request_master_data(this.entityTypeMasterRepository.count(), type);
}

@Test
void fetch_format_master_200() {
final String type = "format";
this.request_master_data(this.formatTypeMasterRepository.count(), type);
}

@Test
void fetch_registration_master_200() {
final String type = "registration";
this.request_master_data(this.registrationTypeMasterRepository.count(), type);
}

@Test
void fetch_request_master_200() {
final String type = "request";
this.request_master_data(this.requestTypeMasterRepository.count(), type);
}

@Test
void fetch_standard_master_200() {
final String type = "standard";
this.request_master_data(this.standardTypeMasterRepository.count(), type);
}

@Test
void fetch_subdivision_master_200() {
final String type = "subdivision";
this.request_master_data(this.subdivisionCodeMasterRepository.count(), type);
}

@Test
void fetch_spdx_master_200() {
final String type = "spdxLicense";
this.request_master_data(this.spdxLicenseMasterRepository.count(), type);
}

private void request_master_data(Long count, String type) {
FilterRequest request = HelperService.prepareDefaultFilterRequest();
ResponseEntity<CommonResponse> response = this.restTemplate.exchange("/public/master-data/" + type + "/filter", HttpMethod.POST, new HttpEntity<>(request), CommonResponse.class);
Expand All @@ -121,7 +121,7 @@ private void request_master_data(Long count, String type) {
assertEquals(count, pageResponse.getPageable().getTotalElements());
assertTrue(((Collection<?>) pageResponse.getContent()).size() > 0);
}

@Test
void fetch_subdivision_name_200() {
final String type = "subdivisionMaster";
Expand All @@ -132,19 +132,19 @@ void fetch_subdivision_name_200() {
Map<String, Object> payload = (Map<String, Object>) response.getBody().getPayload();
assertEquals(Collections.singletonList("Brussels Hoofdstedelijk Gewest"), payload.get("serviceAvailabilityLocation"));
}

@Test
void fetch_subdivision_master_400() {
final String type = "subdivisionMaster";
FilterRequest request = HelperService.prepareDefaultFilterRequest();
ResponseEntity<CommonResponse> response = this.restTemplate.exchange("/public/master-data/" + type + "/filter", HttpMethod.POST, new HttpEntity<>(request), CommonResponse.class);
assertEquals(HttpStatus.BAD_REQUEST, response.getStatusCode());
}

@Test
void fetch_label_level_list_200() {
List<LabelLevelTypeInterface> labelLevelTypeAndQuestionList = this.labelLevelService.getLabelLevelTypeAndQuestionList();
assertThat(labelLevelTypeAndQuestionList).isNotNull();
}

}

0 comments on commit 3a50c6b

Please sign in to comment.