Skip to content

Commit

Permalink
Improve code coverage for FileAnnotationWrapper and reformat code
Browse files Browse the repository at this point in the history
  • Loading branch information
ppouchin committed Jan 22, 2023
1 parent 70d715d commit afa5ef4
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 10 deletions.
1 change: 1 addition & 0 deletions src/main/java/fr/igred/omero/repository/PixelsWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public class PixelsWrapper extends GenericObjectWrapper<PixelsData> {
*/
public PixelsWrapper(PixelsData pixels) {
super(pixels);
rawDataFacility = null;
}


Expand Down
4 changes: 2 additions & 2 deletions src/main/java/fr/igred/omero/repository/package-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
/**
* This package contains classes related to the hierarchical organization for images.
* <p> This includes containers (such as screens or projects for example), as well as data contained within images (e.g.
* pixels and channels).
* <p> This includes containers (such as screens or projects for example), as well as data contained within images
* (e.g. pixels and channels).
*/
package fr.igred.omero.repository;
1 change: 1 addition & 0 deletions src/test/java/fr/igred/omero/annotations/TableTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -196,4 +196,5 @@ void testErrorTableNotEnoughArgs() throws Exception {
assertThrows(IllegalArgumentException.class,
() -> images.forEach(img -> table.addRow(img.asImageData())));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ void testComputeMeanTimeInterval() throws Exception {
assertEquals(time.getValue(), pixels.getMeanTimeInterval().getValue());
}


@Test
void testComputeMeanExposureTime() throws Exception {
PixelsWrapper pixels = client.getImage(IMAGE1.id).getPixels();
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/fr/igred/omero/repository/FolderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void testGetDeletedFolder() throws Exception {
ImageWrapper image = client.getImage(IMAGE2.id);

FolderWrapper folder = new FolderWrapper(client, "Test");
long id = folder.getId();
long id = folder.getId();
client.delete(folder);
assertThrows(NoSuchElementException.class, () -> image.getFolder(client, id));
}
Expand Down
6 changes: 6 additions & 0 deletions src/test/java/fr/igred/omero/repository/ImageTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,16 @@
import ij.plugin.ImageCalculator;
import ij.process.ImageStatistics;
import loci.plugins.BF;
import omero.constants.metadata.NSCLIENTMAPANNOTATION;
import omero.gateway.model.MapAnnotationData;
import omero.model.NamedValue;
import org.junit.jupiter.api.Test;

import java.awt.image.BufferedImage;
import java.io.File;
import java.nio.file.Files;
import java.sql.Timestamp;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
Expand Down Expand Up @@ -225,6 +228,7 @@ void testAddKeyValuePair4() throws Exception {
String value1 = "Value Test";
String value2 = "Value Test2";

Timestamp ts = Timestamp.from(Instant.now());
image.addPairKeyValue(client, key1, value1);
image.addPairKeyValue(client, key2, value2);

Expand All @@ -234,6 +238,8 @@ void testAddKeyValuePair4() throws Exception {
client.delete(maps);

assertEquals(2, maps.size());
assertEquals(NSCLIENTMAPANNOTATION.value, maps.get(0).getNameSpace());
assertEquals(0, (maps.get(0).getLastModified().getTime() - ts.getTime()) / 1000);
assertEquals(value1, value);
}

Expand Down
4 changes: 2 additions & 2 deletions src/test/java/fr/igred/omero/repository/WellSampleTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ void testGetImage() throws Exception {

@Test
void testGetWell() throws Exception {
final long wellId = 1L;
WellWrapper well = client.getWell(wellId);
final long wellId = 1L;
WellWrapper well = client.getWell(wellId);
WellSampleWrapper sample = well.getWellSamples().get(0);

assertEquals(wellId, sample.getWell(client).getId());
Expand Down
10 changes: 5 additions & 5 deletions src/test/java/fr/igred/omero/roi/ShapeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ void testRectangleConstructor() {
void testMaskConstructor() {
byte[] maskValues = new byte[25];
for (int i = 0; i < maskValues.length; i++) {
maskValues[i] = (byte) (i >= maskValues.length/2 ? 1 : 0);
maskValues[i] = (byte) (i >= maskValues.length / 2 ? 1 : 0);
}

MaskWrapper m1 = new MaskWrapper(10, 10, 5, 5, maskValues);
Expand Down Expand Up @@ -465,7 +465,7 @@ void testPolygonConstructor() {
void testAWTRectangle() {
RectangleWrapper shape = new RectangleWrapper(25, 26, 27, 28);
Rectangle2D awtShape = new Rectangle2D.Double(25, 26, 27, 28);
java.awt.Shape awtShape2 = shape.toAWTShape();
java.awt.Shape awtShape2 = shape.toAWTShape();
assertEquals(awtShape, awtShape2);
}

Expand All @@ -474,10 +474,10 @@ void testAWTRectangle() {
void testAWTMask() {
byte[] maskValues = new byte[25];
for (int i = 0; i < maskValues.length; i++) {
maskValues[i] = (byte) (i >= maskValues.length/2 ? 1 : 0);
maskValues[i] = (byte) (i >= maskValues.length / 2 ? 1 : 0);
}
MaskWrapper shape = new MaskWrapper(25, 26, 27, 28, maskValues);
Rectangle2D awtShape = new Rectangle2D.Double(25, 26, 27, 28);
MaskWrapper shape = new MaskWrapper(25, 26, 27, 28, maskValues);
Rectangle2D awtShape = new Rectangle2D.Double(25, 26, 27, 28);

java.awt.Shape awtShape2 = shape.toAWTShape();
assertEquals(awtShape, awtShape2);
Expand Down

0 comments on commit afa5ef4

Please sign in to comment.