/*
 * Copyright (c) 2002-2018 "Neo Technology,"
 * Network Engine for Objects in Lund AB [http://neotechnology.com]
 *
 * This product is licensed to you under the Apache License, Version 2.0 (the "License").
 * You may not use this product except in compliance with the License.
 *
 * This product may include a number of subcomponents with
 * separate copyright notices and license terms. Your use of the source
 * code for these subcomponents is subject to the terms and
 *  conditions of the subcomponent's license, as noted in the LICENSE file.
 */

package org.neo4j.ogm.metadata.schema;

import java.util.HashMap;
import java.util.Map;

/**
 * @author Frantisek Hartman
 */
class SchemaImpl implements Schema {

    private Map<String, NodeImpl> nodes = new HashMap<>();
    private Map<String, Relationship> relationships = new HashMap<>();

    void addNode(String label, NodeImpl node) {
        nodes.put(label, node);
    }

    void addRelationship(RelationshipImpl relationship) {
        relationships.put(relationship.type(), relationship);
    }

    @Override
    public Node findNode(String label) {
        return nodes.computeIfAbsent(label, s -> {
            throw new IllegalArgumentException("Unknown label " + label);
        });
    }

    @Override
    public Relationship findRelationship(String type) {
        return relationships.computeIfAbsent(type, s -> {
            throw new IllegalArgumentException("Unknown type " + type);
        });
    }

    Relationship getRelationship(String type) {
        return relationships.get(type);
    }

}

@@ -670,16 +670,45 @@
 Hartman%0A
+ * @author Michael J. Simons%0A
  */%0Aclas
@@ -1137,32 +1137,33 @@
 ng label) %7B%0A
+%0A
         
 return nodes
@@ -1154,23 +1154,21 @@
     
-return 
+if (!
 nodes.co
 mput
@@ -1167,33 +1167,25 @@
 s.co
-mputeIfAbsent(label, s -%3E
+ntainsKey(label))
  %7B%0A 
@@ -1258,32 +1258,63 @@
 abel);%0A        %7D
+%0A        return nodes.get(label
 );%0A    %7D%0A%0A    @O
@@ -1373,32 +1373,33 @@
 ing type) %7B%0A
+%0A
         
 return relat
@@ -1378,39 +1378,37 @@
 ype) %7B%0A%0A        
-return 
+if (!
 relationships.co
@@ -1411,32 +1411,24 @@
 s.co
-mputeIfAbsent(type, s -%3E
+ntainsKey(type))
  %7B%0A 
@@ -1494,24 +1494,24 @@
  %22 + type);%0A
-
         %7D);%0A
@@ -1507,16 +1507,55 @@
        %7D
+%0A%0A        return relationships.get(type
 );%0A    %7D

Remove wrong usage of computeIfAbsent.