// Path: kramer/src/main/java/com/chiralbehaviors/layout/schema/Relation.java
// public class Relation extends SchemaNode {
//     private boolean                autoFold = true;
//     private final List<SchemaNode> children = new ArrayList<>();
//     private Relation               fold;
// 
//     public Relation(String label) {
//         super(label);
//     }
// 
//     public void addChild(SchemaNode child) {
//         children.add(child);
//     }
// 
//     public Relation getAutoFoldable() {
//         if (fold != null) {
//             return fold;
//         }
//         return autoFold && children.size() == 1
//                && children.get(children.size() - 1) instanceof Relation
//                                                                         ? (Relation) children.get(0)
//                                                                         : null;
//     }
// 
//     public SchemaNode getChild(String field) {
//         for (SchemaNode child : children) {
//             if (child.getField()
//                      .equals(field)) {
//                 return child;
//             }
//         }
//         return null;
//     }
// 
//     public List<SchemaNode> getChildren() {
//         return children;
//     }
// 
//     public Relation getFold() {
//         return fold;
//     }
// 
//     @JsonProperty
//     public boolean isFold() {
//         return fold != null;
//     }
// 
//     @Override
//     public boolean isRelation() {
//         return true;
//     }
// 
//     public void setFold(boolean fold) {
//         this.fold = (fold && children.size() == 1 && children.get(0)
//                                                              .isRelation()) ? (Relation) children.get(0)
//                                                                             : null;
//     }
// 
//     @Override
//     public String toString() {
//         return toString(0);
//     }
// 
//     @Override
//     public String toString(int indent) {
//         StringBuffer buf = new StringBuffer();
//         buf.append(String.format("Relation [%s]", label));
//         buf.append('\n');
//         children.forEach(c -> {
//             for (int i = 0; i < indent; i++) {
//                 buf.append("    ");
//             }
//             buf.append("  - ");
//             buf.append(c.toString(indent + 1));
//             if (!c.equals(children.get(children.size() - 1))) {
//                 buf.append('\n');
//             }
//         });
//         return buf.toString();
//     }
// }


import com.chiralbehaviors.layout.schema.Relation;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Paths;
import org.junit.Test;
/**
 * Copyright (c) 2017 Chiral Behaviors, LLC, all rights reserved.
 * 
 
 *  This file is part of Ultrastructure.
 *
 *  Ultrastructure is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Affero General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  ULtrastructure is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Affero General Public License for more details.
 *
 *  You should have received a copy of the GNU Affero General Public License
 *  along with Ultrastructure.  If not, see <http://www.gnu.org/licenses/>.
 */

package com.chiralbehaviors.layout.graphql;





/**
 * @author halhildebrand
 *
 */
public class TestGraphQlUtil {

    @Test
    public void testFragments() throws Exception {

// Path: kramer/src/main/java/com/chiralbehaviors/layout/schema/Relation.java
// public class Relation extends SchemaNode {
//     private boolean                autoFold = true;
//     private final List<SchemaNode> children = new ArrayList<>();
//     private Relation               fold;
// 
//     public Relation(String label) {
//         super(label);
//     }
// 
//     public void addChild(SchemaNode child) {
//         children.add(child);
//     }
// 
//     public Relation getAutoFoldable() {
//         if (fold != null) {
//             return fold;
//         }
//         return autoFold && children.size() == 1
//                && children.get(children.size() - 1) instanceof Relation
//                                                                         ? (Relation) children.get(0)
//                                                                         : null;
//     }
// 
//     public SchemaNode getChild(String field) {
//         for (SchemaNode child : children) {
//             if (child.getField()
//                      .equals(field)) {
//                 return child;
//             }
//         }
//         return null;
//     }
// 
//     public List<SchemaNode> getChildren() {
//         return children;
//     }
// 
//     public Relation getFold() {
//         return fold;
//     }
// 
//     @JsonProperty
//     public boolean isFold() {
//         return fold != null;
//     }
// 
//     @Override
//     public boolean isRelation() {
//         return true;
//     }
// 
//     public void setFold(boolean fold) {
//         this.fold = (fold && children.size() == 1 && children.get(0)
//                                                              .isRelation()) ? (Relation) children.get(0)
//                                                                             : null;
//     }
// 
//     @Override
//     public String toString() {
//         return toString(0);
//     }
// 
//     @Override
//     public String toString(int indent) {
//         StringBuffer buf = new StringBuffer();
//         buf.append(String.format("Relation [%s]", label));
//         buf.append('\n');
//         children.forEach(c -> {
//             for (int i = 0; i < indent; i++) {
//                 buf.append("    ");
//             }
//             buf.append("  - ");
//             buf.append(c.toString(indent + 1));
//             if (!c.equals(children.get(children.size() - 1))) {
//                 buf.append('\n');
//             }
//         });
//         return buf.toString();
//     }
// }


// Path: kramer-ql/src/test/java/com/chiralbehaviors/layout/graphql/TestGraphQlUtil.java
import com.chiralbehaviors.layout.schema.Relation;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Paths;
import org.junit.Test;

/**
 * Copyright (c) 2017 Chiral Behaviors, LLC, all rights reserved.
 * 
 
 *  This file is part of Ultrastructure.
 *
 *  Ultrastructure is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Affero General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  ULtrastructure is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Affero General Public License for more details.
 *
 *  You should have received a copy of the GNU Affero General Public License
 *  along with Ultrastructure.  If not, see <http://www.gnu.org/licenses/>.
 */

package com.chiralbehaviors.layout.graphql;





/**
 * @author halhildebrand
 *
 */
public class TestGraphQlUtil {

    @Test
    public void testFragments() throws Exception {

        Relation relation = GraphQlUtil.buildSchema(readFile("target/test-classes/fragment.query"));