Skip to content

Commit

Permalink
Implement SonarCloud quality suggestions #159
Browse files Browse the repository at this point in the history
  • Loading branch information
pkiraly committed Dec 8, 2023
1 parent 20fe7a6 commit 1a71c59
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
package de.gwdg.metadataqa.api.configuration;

import com.jayway.jsonpath.InvalidJsonException;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

import java.io.FileNotFoundException;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

public class ConfigurationReaderTest {

@Rule
public ExpectedException thrown = ExpectedException.none();

@Test
public void readSchemaJson() {
}
Expand All @@ -27,6 +34,17 @@ public void readMeasurementJson() throws FileNotFoundException {
}

@Test
public void readNonexistentConfiguration() throws FileNotFoundException {
thrown.expect(FileNotFoundException.class);
thrown.expectMessage("src/test/resources/configuration/measurement/non-existent-configuration.json (No such file or directory)");

MeasurementConfiguration configuration = ConfigurationReader
.readMeasurementJson("src/test/resources/configuration/measurement/non-existent-configuration.json");

fail("Should throw an exception if the JSON file is not existent.");
}

@Test
public void readMeasurementYaml() throws FileNotFoundException {
MeasurementConfiguration configuration = ConfigurationReader
.readMeasurementYaml("src/test/resources/configuration/measurement/configuration.yaml");
Expand Down

0 comments on commit 1a71c59

Please sign in to comment.