Repository: Wikidata/Wikidata-Toolkit
Pull request #574 (2021-04-29 11:21:34)

Allows empty gloss list in Sense
Follows WikibaseLexemes changes

codecov[bot]: # [Codecov](https://codecov.io/gh/Wikidata/Wikidata-Toolkit/pull/574?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Wikidata) Report
> Merging [#574](https://codecov.io/gh/Wikidata/Wikidata-Toolkit/pull/574?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Wikidata) (a65d89e) into [master](https://codecov.io/gh/Wikidata/Wikidata-Toolkit/commit/8236ccbf9f019b996e48fddb4c7b765810b8c8e3?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Wikidata) (8236ccb) will **increase** coverage by `0.01%`.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/Wikidata/Wikidata-Toolkit/pull/574/graphs/tree.svg?width=650&height=150&src=pr&token=QtTNJdTAbO&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Wikidata)](https://codecov.io/gh/Wikidata/Wikidata-Toolkit/pull/574?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Wikidata)

```diff
@@             Coverage Diff              @@
##             master     #574      +/-   ##
============================================
+ Coverage     81.04%   81.05%   +0.01%     
+ Complexity     2085     2084       -1     
============================================
  Files           149      149              
  Lines          7290     7286       -4     
  Branches        895      888       -7     
============================================
- Hits           5908     5906       -2     
+ Misses         1113     1112       -1     
+ Partials        269      268       -1     
```


| [Impacted Files](https://codecov.io/gh/Wikidata/Wikidata-Toolkit/pull/574?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Wikidata) | Coverage Δ | Complexity Δ | |
|---|---|---|---|
| [...tk/datamodel/implementation/SenseDocumentImpl.java](https://codecov.io/gh/Wikidata/Wikidata-Toolkit/pull/574/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Wikidata#diff-d2R0ay1kYXRhbW9kZWwvc3JjL21haW4vamF2YS9vcmcvd2lraWRhdGEvd2R0ay9kYXRhbW9kZWwvaW1wbGVtZW50YXRpb24vU2Vuc2VEb2N1bWVudEltcGwuamF2YQ==) | `91.17% <ø> (+4.33%)` | `16.00 <0.00> (-1.00)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/Wikidata/Wikidata-Toolkit/pull/574?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Wikidata).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Wikidata)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/Wikidata/Wikidata-Toolkit/pull/574?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Wikidata). Last update [8236ccb...a65d89e](https://codecov.io/gh/Wikidata/Wikidata-Toolkit/pull/574?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Wikidata). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Wikidata).


Patch:
diff --git a/wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/implementation/SenseDocumentImpl.java b/wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/implementation/SenseDocumentImpl.java
index 52f80384..6d4bfa3a 100644
--- a/wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/implementation/SenseDocumentImpl.java
+++ b/wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/implementation/SenseDocumentImpl.java
@@ -67,9 +67,6 @@ public class SenseDocumentImpl extends StatementDocumentImpl implements SenseDoc
 			long revisionId) {
 		super(id, statements, revisionId);
 		Validate.notNull(glosses, "Senses glosses should not be null");
-		if(glosses.isEmpty()) {
-			throw new IllegalArgumentException("Senses should have at least one gloss");
-		}
 		this.glosses = constructTermMap(glosses);
 	}
 
@@ -86,9 +83,6 @@ public class SenseDocumentImpl extends StatementDocumentImpl implements SenseDoc
 			@JacksonInject("siteIri") String siteIri) {
 		super(jsonId, claims, revisionId, siteIri);
 		Validate.notNull(glosses, "Senses glosses should not be null");
-		if(glosses.isEmpty()) {
-			throw new IllegalArgumentException("Senses should have at least one gloss");
-		}
 		this.glosses = glosses;
 	}
 


Test patch:
diff --git a/wdtk-datamodel/src/test/java/org/wikidata/wdtk/datamodel/implementation/SenseDocumentImplTest.java b/wdtk-datamodel/src/test/java/org/wikidata/wdtk/datamodel/implementation/SenseDocumentImplTest.java
index 0df962a6..2774395b 100644
--- a/wdtk-datamodel/src/test/java/org/wikidata/wdtk/datamodel/implementation/SenseDocumentImplTest.java
+++ b/wdtk-datamodel/src/test/java/org/wikidata/wdtk/datamodel/implementation/SenseDocumentImplTest.java
@@ -114,8 +114,8 @@ public class SenseDocumentImplTest {
 	}
 
 	@Test
-	public void glossesNotEmpty() {
-		assertThrows(IllegalArgumentException.class, () -> new SenseDocumentImpl(sid, Collections.emptyList(), statementGroups, 1234));
+	public void glossesEmpty() {
+		assertEquals(Collections.emptyMap(), new SenseDocumentImpl(sid, Collections.emptyList(), statementGroups, 1234).getGlosses());
 	}
 
 	@Test