Skip to content
Snippets Groups Projects
Commit b9649ef5 authored by kaloyane's avatar kaloyane
Browse files

fix: the toWellIdString() should also work for large 32x48 plates

SVN: 23426
parent bd73541f
No related branches found
No related tags found
No related merge requests found
......@@ -18,6 +18,7 @@ package ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto;
import ch.systemsx.cisd.openbis.generic.shared.basic.ISerializable;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ServiceVersionHolder;
import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.PlateUtils;
/**
* Describes position of the well on the plate.
......@@ -243,12 +244,7 @@ public class WellLocation implements ISerializable
public String toWellIdString()
{
return getNumberLetter(row) + column;
}
private String getNumberLetter(@SuppressWarnings("hiding") int row)
{
return Character.toString((char) ((char) row + 'A' - (char) 1));
return PlateUtils.translateRowNumberIntoLetterCode(row) + column;
}
@Override
......
......@@ -31,7 +31,7 @@ public class WellLocationTest
{
@DataProvider(name = "valid spreadsheet locations")
public Object[][] provideCorrectData()
Object[][] provideCorrectData()
{
return new Object[][]
{
......@@ -56,6 +56,25 @@ public class WellLocationTest
.toString(row), Integer.toString(col)));
}
@DataProvider(name = "valid well ids")
Object[][] provideWellIdStrings()
{
return new Object[][]
{
{ "A1", 1, 1 },
{ "A123", 1, 123 },
{ "B9", 2, 9 },
{ "C23", 3, 23 },
{ "AA1", 27, 1 },
{ "ZZ1000", 26 * 26 + 26, 1000 } };
}
@Test(dataProvider = "valid well ids")
public void testGetWellIdString(String location, int row, int col)
{
assertEquals(location, new WellLocation(row, col).toWellIdString());
}
@Test
public void testParseLocationStrWithEmptyString()
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment