Class FactorValueValueObjectSerializerTest

java.lang.Object
ubic.gemma.core.util.test.BaseTest5
ubic.gemma.rest.serializers.FactorValueValueObjectSerializerTest

@ContextConfiguration public class FactorValueValueObjectSerializerTest extends BaseTest5
  • Constructor Details

    • FactorValueValueObjectSerializerTest

      public FactorValueValueObjectSerializerTest()
  • Method Details

    • test

      @Test public void test() throws com.fasterxml.jackson.core.JsonProcessingException, ParseException
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
      ParseException
    • aBaselineFactorValueSaysSoOnTheWire

      @Test public void aBaselineFactorValueSaysSoOnTheWire() throws com.fasterxml.jackson.core.JsonProcessingException
      The baseline designation reaches the wire.

      This serializer replaces the bean path for every factor value the API returns, and it hand-writes the fields — so the @JsonProperty("isBaseline") on the VO was dead, and no endpoint said which factor value was the reference level even though 665 rows on prod are marked. A design GET could not tell a curator, and a GET → PUT round-trip could not carry the designation back.

      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • anUndesignatedFactorValueOmitsTheFlagRatherThanSayingFalse

      @Test public void anUndesignatedFactorValueOmitsTheFlagRatherThanSayingFalse() throws com.fasterxml.jackson.core.JsonProcessingException
      Absent, not false, when nothing was designated. The flag is three-valued on write — null means "no change" — so a rendered false has to keep meaning "explicitly not the baseline".
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • aStatementWithNothingSaidAboutItStillAppearsInStatements

      @Test public void aStatementWithNothingSaidAboutItStillAppearsInStatements() throws com.fasterxml.jackson.core.JsonProcessingException
      🛑 A grounded value with no predicate is still a statement, and it has to appear in statements.

      It used to appear only under characteristics, so the commonest annotation in the corpus — organism part: chorionic villus — arrived as statements: []. Three teams read that as "this factor value has no statement" on 2026-08-28: a write-back was diagnosed against the wrong cause, and a grounded UBERON term rendered as free text on every organism-part value of one dataset.

      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • aCompoundStatementIsFlattenedIntoTwoStatementsRatherThanExposingTheSecondClauseFields

      @Test public void aCompoundStatementIsFlattenedIntoTwoStatementsRatherThanExposingTheSecondClauseFields() throws com.fasterxml.jackson.core.JsonProcessingException
      A compound statement reaches the wire flattened: two entries in statements sharing one subject, the second clause carrying secondPredicate / secondObject under the generic predicate / object keys.

      This pins the reason the four second* fields on StatementValueObject are annotated @WithheldFromApi(REDUNDANT): the data is already published, under another name, by this serializer. Un-hide them and a client reading both shapes sees the second clause twice. The behaviour dates to dff752727c (fix #814), which un-hid predicate* / object* and added this flattening in the same commit.

      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • aStatementCarriesItsEvidenceOnTheWire

      @Test public void aStatementCarriesItsEvidenceOnTheWire() throws com.fasterxml.jackson.core.JsonProcessingException
      Evidence reaches the wire on the design payload.

      StatementValueObject declares supportingEvidence and evidenceCode and populates both from the entity, but this serializer replaces the bean path and hand-writes each field — so neither key was emitted under statements[] while /annotations returned them for the same row. The consequence was not cosmetic: on the write path supportingEvidence: [] ERASES, so a client that could not read the current value had no safe way to merge into it.

      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • aFactorValueCarriesItsOwnEvidenceOnTheWire

      @Test public void aFactorValueCarriesItsOwnEvidenceOnTheWire() throws com.fasterxml.jackson.core.JsonProcessingException
      A factor value's OWN evidence reaches the wire, distinct from its statements'.

      Declared on AbstractFactorValueValueObject and inherited by both concrete VOs, so it appears in the OpenAPI schema for FactorValueValueObject — while the hand-written serializer dropped it, so a curator's evidence on the factor value itself was write-only.

      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • aStatementWithoutEvidenceOmitsTheKeys

      @Test public void aStatementWithoutEvidenceOmitsTheKeys() throws com.fasterxml.jackson.core.JsonProcessingException
      Absent, not null, when there is no evidence — null reads as "this was cleared" on a payload whose write path treats an empty send as an erasure.
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException