Skip to content

Commit

Permalink
Add tests and improve code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
ppouchin committed Mar 22, 2024
1 parent 3191163 commit fb20703
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 1 deletion.
21 changes: 21 additions & 0 deletions src/test/java/fr/igred/omero/repository/PlateAcquisitionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,27 @@ void testAddTagToPlateAcquisition() throws Exception {
}


@Test
void testAddAndRemoveTagFromPlateAcquisition() throws Exception {
PlateWrapper plate = client.getPlate(PLATE1.id);

PlateAcquisitionWrapper acq = plate.getPlateAcquisitions().get(0);

String name = "Plate acq. tag";
String desc = "tag attached to a plate acq.";

TagAnnotationWrapper tag = new TagAnnotationWrapper(client, name, desc);
acq.link(client, tag);
List<TagAnnotationWrapper> tags = acq.getTags(client);
acq.unlink(client, tag);
List<TagAnnotationWrapper> removedTags = acq.getTags(client);
client.delete(tag);

assertEquals(1, tags.size());
assertEquals(0, removedTags.size());
}


@Test
void testSetName() throws Exception {
PlateWrapper plate = client.getPlate(PLATE1.id);
Expand Down
19 changes: 19 additions & 0 deletions src/test/java/fr/igred/omero/repository/PlateTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,25 @@ void testAddTagToPlate() throws Exception {
}


@Test
void testAddAndRemoveTagFromPlate() throws Exception {
PlateWrapper plate = client.getPlate(PLATE2.id);

String name = "Plate tag";
String desc = "tag attached to a plate";

TagAnnotationWrapper tag = new TagAnnotationWrapper(client, name, desc);
plate.link(client, tag);
List<TagAnnotationWrapper> tags = plate.getTags(client);
plate.unlink(client, tag);
List<TagAnnotationWrapper> removedTags = plate.getTags(client);
client.delete(tag);

assertEquals(1, tags.size());
assertEquals(0, removedTags.size());
}


@Test
void testSetName() throws Exception {
PlateWrapper plate = client.getPlate(PLATE1.id);
Expand Down
22 changes: 21 additions & 1 deletion src/test/java/fr/igred/omero/repository/ScreenTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package fr.igred.omero.repository;


import fr.igred.omero.GatewayWrapper;
import fr.igred.omero.UserTest;
import fr.igred.omero.annotations.TagAnnotationWrapper;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -90,6 +91,25 @@ void testAddTagToScreen() throws Exception {
}


@Test
void testAddAndRemoveTagFromScreen() throws Exception {
ScreenWrapper screen = client.getScreen(SCREEN2.id);

String name = "Screen tag";
String desc = "tag attached to a screen";

TagAnnotationWrapper tag = new TagAnnotationWrapper(client, name, desc);
screen.link(client, tag);
List<TagAnnotationWrapper> tags = screen.getTags(client);
screen.unlink(client, tag);
List<TagAnnotationWrapper> removedTags = screen.getTags(client);
client.delete(tag);

assertEquals(1, tags.size());
assertEquals(0, removedTags.size());
}


@Test
void testSetName() throws Exception {
ScreenWrapper screen = client.getScreen(SCREEN1.id);
Expand Down Expand Up @@ -248,7 +268,7 @@ void testImportImage() throws Exception {
client.delete(wells);
client.delete(plates);

screen.refresh(client);
screen.refresh((GatewayWrapper) client);
List<PlateWrapper> endPlates = screen.getPlates();

client.delete(screen);
Expand Down
19 changes: 19 additions & 0 deletions src/test/java/fr/igred/omero/repository/WellTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,25 @@ void testAddTagToWell() throws Exception {
}


@Test
void testAddAndRemoveTagFromWell() throws Exception {
WellWrapper well = client.getWell(2L);

String name = "Well tag";
String desc = "tag attached to a well";

TagAnnotationWrapper tag = new TagAnnotationWrapper(client, name, desc);
well.link(client, tag);
List<TagAnnotationWrapper> tags = well.getTags(client);
well.unlink(client, tag);
List<TagAnnotationWrapper> removedTags = well.getTags(client);
client.delete(tag);

assertEquals(1, tags.size());
assertEquals(0, removedTags.size());
}


@Test
void testGetWellSamples() throws Exception {
WellWrapper well = client.getWell(1L);
Expand Down

0 comments on commit fb20703

Please sign in to comment.