@Test void testGetMtaNotUniqueByName() { Mockito.when(deployedMtaDetector.detectDeployedMtasByName("name_thats_not_unique", client)) .thenReturn(getDeployedMtas(mtas)); Assertions.assertThrows(ConflictException.class, () -> testedClass.getMta(SPACE_GUID, "name_thats_not_unique")); }
@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);  }