@Test void testGetMta() { Mta mtaToGet = mtas.get(1); Mockito.when(deployedMtaDetector.detectDeployedMtasByName(mtaToGet.getMetadata() .getId(), client)) .thenReturn(List.of(getDeployedMta(mtaToGet))); ResponseEntity<Mta> response = testedClass.getMta(SPACE_GUID, mtaToGet.getMetadata() .getId()); assertEquals(HttpStatus.OK, response.getStatusCode()); Mta responseMta = response.getBody(); assertEquals(mtaToGet, responseMta); }
@Override public ResponseEntity<Mta> getMta(String spaceGuid, String mtaId) { List<DeployedMta> mtas = deployedMtaDetector.detectDeployedMtasByName(mtaId, getCloudFoundryClient(spaceGuid)); if (mtas.isEmpty()) { throw new NotFoundException(Messages.MTA_NOT_FOUND, mtaId); } if (mtas.size() != 1) { throw new ConflictException(Messages.MTA_SEARCH_NOT_UNIQUE_BY_NAME, mtaId); } return ResponseEntity.ok() .body(getMta(mtas.get(0))); }
MtasApiServiceImpl implements MtasApiService { @Override public ResponseEntity<Mta> getMta(String spaceGuid, String mtaId) { List<DeployedMta> mtas = deployedMtaDetector.detectDeployedMtasByName(mtaId, getCloudFoundryClient(spaceGuid)); if (mtas.isEmpty()) { throw new NotFoundException(Messages.MTA_NOT_FOUND, mtaId); } if (mtas.size() != 1) { throw new ConflictException(Messages.MTA_SEARCH_NOT_UNIQUE_BY_NAME, mtaId); } return ResponseEntity.ok() .body(getMta(mtas.get(0))); } }
MtasApiServiceImpl implements MtasApiService { @Override public ResponseEntity<Mta> getMta(String spaceGuid, String mtaId) { List<DeployedMta> mtas = deployedMtaDetector.detectDeployedMtasByName(mtaId, getCloudFoundryClient(spaceGuid)); if (mtas.isEmpty()) { throw new NotFoundException(Messages.MTA_NOT_FOUND, mtaId); } if (mtas.size() != 1) { throw new ConflictException(Messages.MTA_SEARCH_NOT_UNIQUE_BY_NAME, mtaId); } return ResponseEntity.ok() .body(getMta(mtas.get(0))); }  }
MtasApiServiceImpl implements MtasApiService { @Override public ResponseEntity<Mta> getMta(String spaceGuid, String mtaId) { List<DeployedMta> mtas = deployedMtaDetector.detectDeployedMtasByName(mtaId, getCloudFoundryClient(spaceGuid)); if (mtas.isEmpty()) { throw new NotFoundException(Messages.MTA_NOT_FOUND, mtaId); } if (mtas.size() != 1) { throw new ConflictException(Messages.MTA_SEARCH_NOT_UNIQUE_BY_NAME, mtaId); } return ResponseEntity.ok() .body(getMta(mtas.get(0))); }  @Override ResponseEntity<List<Mta>> getMtas(String spaceGuid); @Override ResponseEntity<Mta> getMta(String spaceGuid, String mtaId); @Override ResponseEntity<List<Mta>> getMtas(String spaceGuid, String namespace, String name); }
MtasApiServiceImpl implements MtasApiService { @Override public ResponseEntity<Mta> getMta(String spaceGuid, String mtaId) { List<DeployedMta> mtas = deployedMtaDetector.detectDeployedMtasByName(mtaId, getCloudFoundryClient(spaceGuid)); if (mtas.isEmpty()) { throw new NotFoundException(Messages.MTA_NOT_FOUND, mtaId); } if (mtas.size() != 1) { throw new ConflictException(Messages.MTA_SEARCH_NOT_UNIQUE_BY_NAME, mtaId); } return ResponseEntity.ok() .body(getMta(mtas.get(0))); }  @Override ResponseEntity<List<Mta>> getMtas(String spaceGuid); @Override ResponseEntity<Mta> getMta(String spaceGuid, String mtaId); @Override ResponseEntity<List<Mta>> getMtas(String spaceGuid, String namespace, String name);  }