### Question:
ClassificationServiceImpl implements ClassificationService { @Override public Classification createClassification(Classification classification) throws ClassificationAlreadyExistException, NotAuthorizedException, DomainNotFoundException, InvalidArgumentException { LOGGER.debug("entry to createClassification(classification = {})", classification); taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN); if (!taskanaEngine.domainExists(classification.getDomain()) && !"".equals(classification.getDomain())) { throw new DomainNotFoundException( classification.getDomain(), "Domain " + classification.getDomain() + " does not exist in the configuration."); } ClassificationImpl classificationImpl; final boolean isClassificationExisting; try { taskanaEngine.openConnection(); isClassificationExisting = doesClassificationExist(classification.getKey(), classification.getDomain()); if (isClassificationExisting) { throw new ClassificationAlreadyExistException(classification); } classificationImpl = (ClassificationImpl) classification; this.checkClassificationId(classificationImpl); classificationImpl.setCreated(Instant.now()); classificationImpl.setModified(classificationImpl.getCreated()); this.initDefaultClassificationValues(classificationImpl); validateAndPopulateParentInformation(classificationImpl); classificationMapper.insert(classificationImpl); if (HistoryEventManager.isHistoryEnabled()) { String details = ObjectAttributeChangeDetector.determineChangesInAttributes( newClassification("", "", ""), classificationImpl); historyEventManager.createEvent( new ClassificationCreatedEvent( IdGenerator.generateWithPrefix(ID_PREFIX_CLASSIFICATION_HISTORY_EVENT), classificationImpl, CurrentUserContext.getUserid(), details)); } LOGGER.debug("Method createClassification created classification {}.", classificationImpl); if (!classification.getDomain().isEmpty()) { addClassificationToMasterDomain(classificationImpl); } } finally { taskanaEngine.returnConnection(); LOGGER.debug("exit from createClassification()"); } return classificationImpl; } ClassificationServiceImpl(
      InternalTaskanaEngine taskanaEngine,
      ClassificationMapper classificationMapper,
      TaskMapper taskMapper); @Override Classification getClassification(String key, String domain); @Override Classification getClassification(String id); @Override void deleteClassification(String classificationId); @Override void deleteClassification(String classificationKey, String domain); @Override Classification createClassification(Classification classification); @Override Classification updateClassification(Classification classification); @Override ClassificationQuery createClassificationQuery(); @Override Classification newClassification(String key, String domain, String type);  }### Answer:
@Test void testThrowExceptionIdIfClassificationIsCreatedWithAnExplicitId() { when(internalTaskanaEngineMock.getEngine()).thenReturn(taskanaEngineMock); ThrowingCallable call = () -> { Classification classification = createDummyClassification(); when(internalTaskanaEngineMock.domainExists(any())).thenReturn(true); cutSpy.createClassification(classification); }; assertThatThrownBy(call) .isInstanceOf(InvalidArgumentException.class) .hasMessage("ClassificationId should be null on creation"); }