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

kit-data-manager / ro-crate-java / #373

28 Apr 2025 09:57AM UTC coverage: 86.891% (+0.9%) from 85.949%
#373

Pull #247

github

web-flow
Merge a4e0ad782 into 0ab3f3ca9
Pull Request #247: Generalize reading and writing crates

249 of 278 new or added lines in 16 files covered. (89.57%)

2 existing lines in 2 files now uncovered.

1889 of 2174 relevant lines covered (86.89%)

0.87 hits per line

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

80.0
/src/main/java/edu/kit/datamanager/ro_crate/reader/FolderStrategy.java
1
package edu.kit.datamanager.ro_crate.reader;
2

3
import com.fasterxml.jackson.databind.ObjectMapper;
4
import com.fasterxml.jackson.databind.node.ObjectNode;
5
import edu.kit.datamanager.ro_crate.objectmapper.MyObjectMapper;
6

7
import java.io.File;
8
import java.io.IOException;
9
import java.nio.file.Path;
10

11
/**
12
 * A class for reading a crate from a folder.
13
 *
14
 * @author Nikola Tzotchev on 9.2.2022 г.
15
 * @version 1
16
 */
17
public class FolderStrategy implements GenericReaderStrategy<String> {
1✔
18

19
  @Override
20
  public ObjectNode readMetadataJson(String location) {
21
    Path metadata = new File(location).toPath().resolve("ro-crate-metadata.json");
1✔
22
    ObjectMapper objectMapper = MyObjectMapper.getMapper();
1✔
23
    ObjectNode objectNode = objectMapper.createObjectNode();
1✔
24
    try {
25
      objectNode = objectMapper.readTree(metadata.toFile()).deepCopy();
1✔
NEW
26
    } catch (IOException e) {
×
NEW
27
      e.printStackTrace();
×
28
    }
1✔
29
    return objectNode;
1✔
30
  }
31

32
  @Override
33
  public File readContent(String location) {
34
    return new File(location);
1✔
35
  }
36
}
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