@Test public void getTargetTypesByNameTest() throws PacManException { when(targetTypesRepository.existsById("targetTypeName123")).thenReturn(true); when(targetTypesRepository.findById(anyString())).thenReturn(getTargetTypesValues()); assertThat(targetTypesService.getTargetTypesByName("targetTypeName123").getCategory(), is(getTargetTypesValues().get().getCategory())); }
@Override public TargetTypes getTargetTypesByName(String targetTypeName) throws PacManException { boolean isTargetTypeExits = targetTypesRepository.existsById(targetTypeName); if (!isTargetTypeExits) { throw new PacManException(AdminConstants.TARGET_TYPE_NAME_NOT_EXITS); } else { return targetTypesRepository.findById(targetTypeName).get(); } }
TargetTypesServiceImpl implements TargetTypesService { @Override public TargetTypes getTargetTypesByName(String targetTypeName) throws PacManException { boolean isTargetTypeExits = targetTypesRepository.existsById(targetTypeName); if (!isTargetTypeExits) { throw new PacManException(AdminConstants.TARGET_TYPE_NAME_NOT_EXITS); } else { return targetTypesRepository.findById(targetTypeName).get(); } } }
TargetTypesServiceImpl implements TargetTypesService { @Override public TargetTypes getTargetTypesByName(String targetTypeName) throws PacManException { boolean isTargetTypeExits = targetTypesRepository.existsById(targetTypeName); if (!isTargetTypeExits) { throw new PacManException(AdminConstants.TARGET_TYPE_NAME_NOT_EXITS); } else { return targetTypesRepository.findById(targetTypeName).get(); } }  }
TargetTypesServiceImpl implements TargetTypesService { @Override public TargetTypes getTargetTypesByName(String targetTypeName) throws PacManException { boolean isTargetTypeExits = targetTypesRepository.existsById(targetTypeName); if (!isTargetTypeExits) { throw new PacManException(AdminConstants.TARGET_TYPE_NAME_NOT_EXITS); } else { return targetTypesRepository.findById(targetTypeName).get(); } }  @Override Collection<String> getTargetTypesNamesByDataSourceName(final String dataSourceName); @Override List<TargetTypes> getAllTargetTypesByDomainList(final List<String> domains); @Override Page<TargetTypesProjections> getAllTargetTypeDetails(String searchTerm, int page, int size); @Override List<String> getAllTargetTypesCategories(); @Override List<TargetTypesDetails> getAllTargetTypes(List<AssetGroupTargetTypes> selectedTargetTypes); @Override List<TargetTypeAttribute> getTargetTypeAttributes(final List<TargetTypes> targetTypes); @Override Map<String, Object> getAttributeValues(AttributeValuesRequest attributeValuesRequest); @Override TargetTypes getTargetTypesByName(String targetTypeName); @Override String updateTargetTypeDetails(CreateUpdateTargetTypeDetailsRequest targetTypesDetails, final String userId); @Override String addTargetTypeDetails(final CreateUpdateTargetTypeDetailsRequest targetTypeDetailsRequest, final String userId); @Override void deleteIndex(String targetTypeIndex); }
TargetTypesServiceImpl implements TargetTypesService { @Override public TargetTypes getTargetTypesByName(String targetTypeName) throws PacManException { boolean isTargetTypeExits = targetTypesRepository.existsById(targetTypeName); if (!isTargetTypeExits) { throw new PacManException(AdminConstants.TARGET_TYPE_NAME_NOT_EXITS); } else { return targetTypesRepository.findById(targetTypeName).get(); } }  @Override Collection<String> getTargetTypesNamesByDataSourceName(final String dataSourceName); @Override List<TargetTypes> getAllTargetTypesByDomainList(final List<String> domains); @Override Page<TargetTypesProjections> getAllTargetTypeDetails(String searchTerm, int page, int size); @Override List<String> getAllTargetTypesCategories(); @Override List<TargetTypesDetails> getAllTargetTypes(List<AssetGroupTargetTypes> selectedTargetTypes); @Override List<TargetTypeAttribute> getTargetTypeAttributes(final List<TargetTypes> targetTypes); @Override Map<String, Object> getAttributeValues(AttributeValuesRequest attributeValuesRequest); @Override TargetTypes getTargetTypesByName(String targetTypeName); @Override String updateTargetTypeDetails(CreateUpdateTargetTypeDetailsRequest targetTypesDetails, final String userId); @Override String addTargetTypeDetails(final CreateUpdateTargetTypeDetailsRequest targetTypeDetailsRequest, final String userId); @Override void deleteIndex(String targetTypeIndex);  }