SymfonionTypeMismatchException.java

1
package com.github.dakusui.symfonion.exceptions;
2
3
import java.io.File;
4
import java.io.Serial;
5
import java.util.Arrays;
6
7
import com.github.dakusui.json.JsonUtils;
8
import com.google.gson.JsonElement;
9
import com.google.gson.JsonObject;
10
11
public class SymfonionTypeMismatchException extends SymfonionSyntaxException {
12
	public static final String OBJECT = "object";
13
	public static final String ARRAY = "array";
14
	public static final String PRIMITIVE = "primitive";
15
	public static final String NULL = "null";
16
17
	/**
18
	 * Serial version UID.
19
	 */
20
	@Serial
21
	private static final long serialVersionUID = 6798033658231719409L;
22
23
24
	public SymfonionTypeMismatchException(String[] expectedTypes, JsonElement actualJSON, JsonElement problemCausingJsonNode, JsonObject root, File sourceFile) {
25
		super(formatMessage(expectedTypes, actualJSON), problemCausingJsonNode, root, sourceFile);
26
	}
27
	
28
	private static String formatMessage(String[] expectedTypes, JsonElement actualJSON) {
29
		String ret;
30 1 1. formatMessage : negated conditional → NO_COVERAGE
		if (expectedTypes == null) {
31
			ret = String.format("%s is not allowed here.", JsonUtils.summarizeJsonElement(actualJSON));
32
		} else {
33
			ret = String.format("%s is not allowed here. Acceptable type(s) are %s", JsonUtils.summarizeJsonElement(actualJSON), Arrays.toString(expectedTypes));
34
		}
35 1 1. formatMessage : replaced return value with "" for com/github/dakusui/symfonion/exceptions/SymfonionTypeMismatchException::formatMessage → NO_COVERAGE
		return ret;
36
	}
37
}

Mutations

30

1.1
Location : formatMessage
Killed by : none
negated conditional → NO_COVERAGE

35

1.1
Location : formatMessage
Killed by : none
replaced return value with "" for com/github/dakusui/symfonion/exceptions/SymfonionTypeMismatchException::formatMessage → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.15.3