### Question:
DataEngineCommonHandler { protected void removeEntity(String userId, String entityGUID, String entityTypeName) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException { final String methodName = "removeEntity"; invalidParameterHandler.validateUserId(userId, methodName); invalidParameterHandler.validateGUID(entityGUID, CommonMapper.GUID_PROPERTY_NAME, methodName); TypeDef entityTypeDef = repositoryHelper.getTypeDefByName(userId, entityTypeName); repositoryHandler.removeEntity(userId, entityGUID, entityTypeDef.getGUID(), entityTypeDef.getName(), null, null, methodName); } DataEngineCommonHandler(String serviceName, String serverName, InvalidParameterHandler invalidParameterHandler,
                                   RepositoryHandler repositoryHandler, OMRSRepositoryHelper repositoryHelper,
                                   DataEngineRegistrationHandler dataEngineRegistrationHandler);   }### Answer:
@Test void removeEntity() throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException { String methodName = "removeEntity"; dataEngineCommonHandler.removeEntity(USER, GUID, ENTITY_TYPE_NAME); verify(invalidParameterHandler, times(1)).validateUserId(USER, methodName); verify(invalidParameterHandler, times(1)).validateGUID(GUID, CommonMapper.GUID_PROPERTY_NAME, methodName); verify(repositoryHandler, times(1)).removeEntity(USER, GUID, ENTITY_TYPE_GUID, ENTITY_TYPE_NAME, null, null, methodName); }
@Test void removeEntity_throwsUserNotAuthorizedException() throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException { String methodName = "removeEntity"; UserNotAuthorizedException mockedException = mockException(UserNotAuthorizedException.class, methodName); doThrow(mockedException).when(repositoryHandler).removeEntity(USER, GUID, ENTITY_TYPE_GUID, ENTITY_TYPE_NAME, null, null, methodName); UserNotAuthorizedException thrown = assertThrows(UserNotAuthorizedException.class, () -> dataEngineCommonHandler.removeEntity(USER, GUID, ENTITY_TYPE_NAME)); assertTrue(thrown.getMessage().contains("OMAS-DATA-ENGINE-404-001 ")); }