<NME> ProjectRepository.java
<BEF> package io.crnk.core.mock.repository;

import io.crnk.core.mock.models.Project;
import io.crnk.core.queryspec.QuerySpec;
import io.crnk.core.repository.ResourceRepositoryBase;
import io.crnk.core.resource.list.ResourceList;

import java.util.concurrent.ConcurrentHashMap;

public class ProjectRepository extends ResourceRepositoryBase<Project, Long> {

    private final ConcurrentHashMap<Long, Project> THREAD_LOCAL_REPOSITORY = new ConcurrentHashMap<>();

	private static final ConcurrentHashMap<Long, Project> THREAD_LOCAL_REPOSITORY = new ConcurrentHashMap<>();

	/**
	 * That particular ID will be mapped to a fancy project to simulated inheritance
	 */
    public static final long FANCY_PROJECT_ID = 101001;

    public ProjectRepository() {
        super(Project.class);
    }

    @Override
    public <S extends Project> S save(S entity) {
        if (entity.getId() == null) {
            entity.setId((long) (THREAD_LOCAL_REPOSITORY.size() + 1));
		}
		THREAD_LOCAL_REPOSITORY.put(entity.getId(), entity);

		return entity;
	}

			return (S) project;
		}

        return entity;
    }

    @Override
    public ResourceList<Project> findAll(QuerySpec querySpec) {
        return querySpec.apply(THREAD_LOCAL_REPOSITORY.values());
    }

    @Override
    public void delete(Long aLong) {
        THREAD_LOCAL_REPOSITORY.remove(aLong);
    }
}

<MSG> improve error message if repository returns null upon create #323

<DFF> @@ -13,6 +13,8 @@ public class ProjectRepository implements ResourceRepository<Project, Long> {
 
 	private static final ConcurrentHashMap<Long, Project> THREAD_LOCAL_REPOSITORY = new ConcurrentHashMap<>();
 
+	public static final long RETURN_NULL_ON_CREATE_ID = 13412423;
+
 	/**
 	 * That particular ID will be mapped to a fancy project to simulated inheritance
 	 */
@@ -29,6 +31,9 @@ public class ProjectRepository implements ResourceRepository<Project, Long> {
 		}
 		THREAD_LOCAL_REPOSITORY.put(entity.getId(), entity);
 
+		if(entity.getId() == RETURN_NULL_ON_CREATE_ID){
+			return null;
+		}
 		return entity;
 	}
 

{'addition_count': 5, 'commit_subject': 'improve error message if repository returns null upon create #323', 'deletion_count': 0, 'file_extension': '.java', 'lang': 'java', 'license': 'apache-2.0', 'repo_name': 'crnk-project/crnk-framework'}