• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Ekryd / sortgraphql / 2150

08 Apr 2024 05:09PM CUT coverage: 98.082%. Remained the same
2150

push

circleci

web-flow
Update dependency commons-io:commons-io to v2.16.1

818 of 834 relevant lines covered (98.08%)

0.98 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/sorter/src/main/java/sortgraphql/sort/FakeRuntimeWiringFactory.java
1
package sortgraphql.sort;
2

3
import static java.util.Optional.ofNullable;
4

5
import graphql.language.Description;
6
import graphql.language.ScalarTypeDefinition;
7
import graphql.schema.Coercing;
8
import graphql.schema.GraphQLScalarType;
9
import graphql.schema.idl.EchoingWiringFactory;
10
import graphql.schema.idl.RuntimeWiring;
11
import graphql.schema.idl.ScalarInfo;
12
import graphql.schema.idl.TypeDefinitionRegistry;
13

14
/** */
15
public class FakeRuntimeWiringFactory {
1✔
16
  static final Coercing<Object, Object> emptyCoercing =
1✔
17
      new Coercing<>() {
1✔
18
        @Override
19
        public Object serialize(Object dataFetcherResult) {
20
          return dataFetcherResult;
1✔
21
        }
22

23
        @Override
24
        public Object parseValue(Object input) {
25
          return input;
1✔
26
        }
27

28
        @Override
29
        public Object parseLiteral(Object input) {
30
          return input;
1✔
31
        }
32
      };
33

34
  public RuntimeWiring createFakeRuntime(TypeDefinitionRegistry registry) {
35
    return EchoingWiringFactory.newEchoingWiring(
1✔
36
        wiringBuilder -> {
37
          var scalars = registry.scalars();
1✔
38
          scalars.forEach(
1✔
39
              (name, v) -> {
40
                if (!ScalarInfo.isGraphqlSpecifiedScalar(name)) {
1✔
41
                  addScalarToWiring(wiringBuilder, name, v);
1✔
42
                }
43
              });
1✔
44
        });
1✔
45
  }
46

47
  private void addScalarToWiring(
48
      RuntimeWiring.Builder wiringBuilder, String scalarName, ScalarTypeDefinition definition) {
49
    var scalarDescription =
1✔
50
        ofNullable(definition)
1✔
51
            .map(ScalarTypeDefinition::getDescription)
1✔
52
            .map(Description::getContent)
1✔
53
            .orElse(null);
1✔
54

55
    wiringBuilder.scalar(
1✔
56
        GraphQLScalarType.newScalar()
1✔
57
            .name(scalarName)
1✔
58
            .description(scalarDescription)
1✔
59
            .coercing(emptyCoercing)
1✔
60
            .build());
1✔
61
  }
1✔
62
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc