Skip to content

Commit

Permalink
Replace printStackTrace with logger. See #199
Browse files Browse the repository at this point in the history
  • Loading branch information
enridaga committed Jan 26, 2022
1 parent 953072f commit 69332b3
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public void triplify(Properties properties, FacadeXGraphBuilder builder) throws
});

} catch (URISyntaxException e) {
e.printStackTrace();
logger.error("",e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@
import org.junit.Test;

import com.github.sparqlanything.model.IRIArgument;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class FolderTriplifierTest {

private static final Logger L = LoggerFactory.getLogger(FolderTriplifierTest.class);
@Test
public void test1() throws MalformedURLException {
FolderTriplifier tt = new FolderTriplifier();
Expand All @@ -67,15 +69,15 @@ public void test1() throws MalformedURLException {
actual.add(q.getObject().getLiteralLexicalForm()
.replace(Paths.get(url.toURI()).toUri().toString(), ""));
} catch (URISyntaxException e) {
e.printStackTrace();
L.error("",e);
}
}
});

assertEquals(expected, actual);

} catch (IOException | URISyntaxException e) {
e.printStackTrace();
L.error("",e);
}
}

Expand Down Expand Up @@ -113,15 +115,15 @@ public void testMatches() throws MalformedURLException {
actual.add(q.getObject().getLiteralLexicalForm()
.replace(Paths.get(url.toURI()).toUri().toString(), ""));
} catch (URISyntaxException e) {
e.printStackTrace();
L.error("",e);
}
}
});

assertEquals(expected, actual);

} catch (IOException | URISyntaxException e) {
e.printStackTrace();
L.error("",e);
}
}

Expand Down Expand Up @@ -153,15 +155,15 @@ public void testBN() throws MalformedURLException {
actual.add(q.getObject().getLiteralLexicalForm()
.replace(Paths.get(url.toURI()).toUri().toString(), ""));
} catch (URISyntaxException e) {
e.printStackTrace();
L.error("",e);
}
}
});

assertEquals(expected, actual);

} catch (IOException | URISyntaxException e) {
e.printStackTrace();
L.error("",e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@
import com.github.sparqlanything.model.IRIArgument;
import com.github.sparqlanything.model.Triplifier;
import com.github.sparqlanything.zip.TarTriplifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class TarTriplifierTest {

private static final Logger L = LoggerFactory.getLogger(TarTriplifierTest.class);
@Test
public void test1() throws MalformedURLException {
TarTriplifier tt = new TarTriplifier();
Expand All @@ -66,7 +68,7 @@ public void test1() throws MalformedURLException {
assertTrue(dg.getGraph(NodeFactory.createURI(Triplifier.getRootArgument(p))).isIsomorphicWith(expectedGraph));

} catch (IOException | URISyntaxException e) {
e.printStackTrace();
L.error("",e);
}
}

Expand Down Expand Up @@ -97,7 +99,7 @@ public void testMatches() throws MalformedURLException {
assertTrue(dg.getGraph(NodeFactory.createURI(Triplifier.getRootArgument(p))).isIsomorphicWith(expectedGraph));

} catch (IOException | URISyntaxException e) {
e.printStackTrace();
L.error("",e);
}
}

Expand Down Expand Up @@ -127,7 +129,7 @@ public void testBNNODE() throws MalformedURLException {
assertTrue(dg.getGraph(NodeFactory.createURI(Triplifier.getRootArgument(p))).isIsomorphicWith(expectedGraph));

} catch (IOException | URISyntaxException e) {
e.printStackTrace();
L.error("",e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@

import com.github.sparqlanything.model.IRIArgument;
import com.github.sparqlanything.model.Triplifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class ZipTriplifierTest {

private static final Logger L = LoggerFactory.getLogger(ZipTriplifierTest.class);
@Test
public void test1() throws MalformedURLException {
ZipTriplifier tt = new ZipTriplifier();
Expand All @@ -67,7 +69,7 @@ public void test1() throws MalformedURLException {
assertTrue(dg.getGraph(NodeFactory.createURI(Triplifier.getRootArgument(p))).isIsomorphicWith(expectedGraph));

} catch (IOException | URISyntaxException e) {
e.printStackTrace();
L.error("",e);
}
}

Expand Down Expand Up @@ -98,7 +100,7 @@ public void testMatches() throws MalformedURLException {
assertTrue(dg.getGraph(NodeFactory.createURI(Triplifier.getRootArgument(p))).isIsomorphicWith(expectedGraph));

} catch (IOException | URISyntaxException e) {
e.printStackTrace();
L.error("",e);
}
}

Expand Down Expand Up @@ -127,7 +129,7 @@ public void testBNNODE() throws MalformedURLException {
assertTrue(dg.getGraph(NodeFactory.createURI(Triplifier.getRootArgument(p))).isIsomorphicWith(expectedGraph));

} catch (IOException | URISyntaxException e) {
e.printStackTrace();
L.error("",e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@
import org.junit.Test;

import com.github.sparqlanything.json.JSONTriplifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class BaseTest {

private static final Logger L = LoggerFactory.getLogger(BaseTest.class);
@Test
public void testContent() throws TriplifierHTTPException {

Expand All @@ -55,7 +57,7 @@ public void testContent() throws TriplifierHTTPException {
assertTrue(g1.getDefaultGraph().isIsomorphicWith(expected));

} catch (IOException e1) {
e1.printStackTrace();
L.error("",e1);
}

}
Expand Down

0 comments on commit 69332b3

Please sign in to comment.