Skip to content
This repository was archived by the owner on Aug 2, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package io.aexp.nodes.graphql.internal;

import java.util.List;
import java.util.Map;

public class CustomError {

private Map<String, Object> extensions;
private String errorType;
private List<Object> path;

public Map<String, Object> getExtensions() {
return extensions;
}

public void setExtensions(Map<String, Object> extensions) {
this.extensions = extensions;
}

public String getErrorType() {
return errorType;
}

public void setErrorType(String errorType) {
this.errorType = errorType;
}

public List<Object> getPath() {
return path;
}

public void setPath(List<Object> path) {
this.path = path;
}

@Override
public String toString() {
return "extensions=" + extensions +
", errorType=" + errorType +
", path=" + path;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import java.util.Arrays;

public final class Error {
public final class Error extends CustomError {

private String message;
private Location[] locations;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright (c) 2018 American Express Travel Related Services Company, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/

package io.aexp.nodes.graphql.internal;

import org.junit.Test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;

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

public class CustomErrorTest {

@Test
public void errorTest() {
Map<String, Object> extensions = new HashMap<String, Object>();
extensions.put("400", "Bad Request");
CustomError customError = new CustomError();
customError.setErrorType("DataFetchingException");
customError.setExtensions(extensions);
customError.setPath(null);
assertNull(customError.getPath());
assertEquals("DataFetchingException", customError.getErrorType());
assertEquals(extensions, customError.getExtensions());
}
}