Skip to content

Commit

Permalink
HUEditorRowId minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
teosarca committed Nov 12, 2017
1 parent 70fb3b0 commit f96d9a2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ private static HUEditorRowId fromJson(@NonNull final String json, final Document
final List<String> parts = PARTS_SPLITTER.splitToList(json);
if (parts.isEmpty())
{
throw new IllegalArgumentException("Invalid HU rowId: " + documentId);
throw new IllegalArgumentException("Invalid HU rowId: " + json);
}
partsIterator = parts.iterator();
}
Expand All @@ -114,7 +114,7 @@ else if (idParts.size() == 2)
}
else
{
throw new IllegalArgumentException("Invalid HU rowId: " + documentId + ". Cannot parse ID part: " + idStrPart);
throw new IllegalArgumentException("Invalid HU rowId: " + json + ". Cannot parse ID part: " + idStrPart);
}
}

Expand All @@ -131,7 +131,7 @@ else if (idParts.size() == 2)
}
else
{
throw new IllegalArgumentException("Invalid HU rowId: " + documentId + ". Cannot parse part: " + part);
throw new IllegalArgumentException("Invalid HU rowId: " + json + ". Cannot parse part: " + part);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package de.metas.ui.web.handlingunits;

import static org.assertj.core.api.Assertions.assertThat;

import org.junit.Assert;
import org.junit.Test;

Expand Down Expand Up @@ -67,14 +69,19 @@ private static void testToFromJson(final HUEditorRowId rowId)
{
final String json = rowId.toJson();
final HUEditorRowId rowId2 = HUEditorRowId.fromJson(json);
Assert.assertEquals(rowId, rowId2);
assertThat(rowId2).isEqualTo(rowId);
}

{
final String json = rowId.toJson();
final DocumentId documentId = DocumentId.of(json);
final HUEditorRowId rowId2 = HUEditorRowId.ofDocumentId(documentId);
Assert.assertEquals(rowId, rowId2);
assertThat(rowId2).isEqualTo(rowId);
}

{
final HUEditorRowId rowId2 = HUEditorRowId.ofDocumentId(rowId.toDocumentId());
assertThat(rowId2).isEqualTo(rowId);
}
}
}

0 comments on commit f96d9a2

Please sign in to comment.