ValueTypeLookup { @VisibleForTesting SampleClass resolve(SampleClass sampleClass) { if (sampleClass == null) return null; if (sampleClass.isSaved()) return sampleClassById.get(sampleClass.getId()); if (sampleClass.getAlias() != null) return sampleClassByAlias.get(sampleClass.getAlias()); return null; } ValueTypeLookup(MisoServiceManager misoServiceManager); void addSubproject(Subproject subproject); boolean isValidSampleClass(String alias); boolean isValidTissueType(String alias); boolean isValidTissueMaterial(String alias); boolean isValidKitDescriptor(String name); boolean isValidSamplePurpose(String alias); boolean isValidLab(String labAlias, String instituteAlias); TissueOrigin resolve(TissueOrigin tissueOrigin); boolean isValidTissueOrigin(String aliasOrDescription); boolean isValidLibrarySelectionType(String name); boolean isValidLibraryStrategyType(String name); boolean isValidLibraryType(String description, String platformType); boolean isValidIndex(String familyName, String sequence); QcType resolveForSample(QcType qcType); boolean isValidSampleQcType(String name); QcType resolveForLibrary(QcType qcType); boolean isValidLibraryQcType(String name); boolean isValidInstrument(String name); boolean isValidSubproject(String alias); boolean isValidDetailedQcStatus(String description); void resolveAll(Sample sample); void resolveAll(Library library); void resolveAll(LibraryAliquot aliquot); void resolveAll(Run run); void resolveAll(Project project); void resolveAll(Box box);  }
@Test public void testResolveSampleClass() { assertNotNull(sut.resolve(makeSampleClass(VALID_LONG, null))); assertNotNull(sut.resolve(makeSampleClass(null, VALID_STRING))); assertNull(sut.resolve((SampleClass) null)); assertNull(sut.resolve(makeSampleClass(null, null))); assertNull(sut.resolve(makeSampleClass(INVALID_LONG, null))); assertNull(sut.resolve(makeSampleClass(null, INVALID_STRING))); }
@Test public void testResolveTissueType() { assertNotNull(sut.resolve(makeTissueType(VALID_LONG, null))); assertNotNull(sut.resolve(makeTissueType(null, VALID_STRING))); assertNull(sut.resolve((TissueType) null)); assertNull(sut.resolve(makeTissueType(null, null))); assertNull(sut.resolve(makeTissueType(INVALID_LONG, null))); assertNull(sut.resolve(makeTissueType(null, INVALID_STRING))); }
@Test public void testResolveTissueMaterial() { assertNotNull(sut.resolve(makeTissueMaterial(VALID_LONG, null))); assertNotNull(sut.resolve(makeTissueMaterial(null, VALID_STRING))); assertNull(sut.resolve((TissueMaterial) null)); assertNull(sut.resolve(makeTissueMaterial(null, null))); assertNull(sut.resolve(makeTissueMaterial(INVALID_LONG, null))); assertNull(sut.resolve(makeTissueMaterial(null, INVALID_STRING))); }
@Test public void testResolveKit() { assertNotNull(sut.resolve(makeKit(VALID_LONG, null))); assertNotNull(sut.resolve(makeKit(null, VALID_STRING))); assertNull(sut.resolve((KitDescriptor) null)); assertNull(sut.resolve(makeKit(null, null))); assertNull(sut.resolve(makeKit(INVALID_LONG, null))); assertNull(sut.resolve(makeKit(null, INVALID_STRING))); }
@Test public void testResolveSamplePurpose() { assertNotNull(sut.resolve(makeSamplePurpose(VALID_LONG, null))); assertNotNull(sut.resolve(makeSamplePurpose(null, VALID_STRING))); assertNull(sut.resolve((SamplePurpose) null)); assertNull(sut.resolve(makeSamplePurpose(null, null))); assertNull(sut.resolve(makeSamplePurpose(INVALID_LONG, null))); assertNull(sut.resolve(makeSamplePurpose(null, INVALID_STRING))); }
@Test public void testResolveLab() { assertNotNull(sut.resolve(makeLab(VALID_LONG, null, null, null))); assertNotNull(sut.resolve(makeLab(null, VALID_STRING, VALID_LONG, null))); assertNotNull(sut.resolve(makeLab(null, VALID_STRING, null, VALID_STRING))); assertNotNull(sut.resolve(makeLab(null, null, UNSPECIFIED_LAB_INST_ID, null))); assertNotNull(sut.resolve(makeLab(null, null, null, UNSPECIFIED_LAB_INST_ALIAS))); assertNull(sut.resolve((Lab) null)); assertNull(sut.resolve(makeLab(null, null, null, null))); assertNull(sut.resolve(makeLab(INVALID_LONG, null, null, null))); assertNull(sut.resolve(makeLab(null, VALID_STRING, null))); assertNull(sut.resolve(makeLab(null, INVALID_STRING, VALID_LONG, null))); assertNull(sut.resolve(makeLab(null, VALID_STRING, INVALID_LONG, null))); assertNull(sut.resolve(makeLab(null, INVALID_STRING, null, VALID_STRING))); assertNull(sut.resolve(makeLab(null, VALID_STRING, null, INVALID_STRING))); }
@Test public void testResolveTissueOrigin() { assertNotNull(sut.resolve(makeTissueOrigin(VALID_LONG, null, null))); assertNotNull(sut.resolve(makeTissueOrigin(null, VALID_STRING, null))); assertNotNull(sut.resolve(makeTissueOrigin(null, null, VALID_STRING))); assertNull(sut.resolve((TissueOrigin) null)); assertNull(sut.resolve(makeTissueOrigin(null, null, null))); assertNull(sut.resolve(makeTissueOrigin(INVALID_LONG, null, null))); assertNull(sut.resolve(makeTissueOrigin(null, INVALID_STRING, null))); assertNull(sut.resolve(makeTissueOrigin(null, null, INVALID_STRING))); }
@Test public void testResolveLibrarySelection() { assertNotNull(sut.resolve(makeLibrarySelection(VALID_LONG, null))); assertNotNull(sut.resolve(makeLibrarySelection(null, VALID_STRING))); assertNull(sut.resolve((LibrarySelectionType) null)); assertNull(sut.resolve(makeLibrarySelection(null, null))); assertNull(sut.resolve(makeLibrarySelection(INVALID_LONG, null))); assertNull(sut.resolve(makeLibrarySelection(null, INVALID_STRING))); }
@Test public void testResolveLibraryStrategy() { assertNotNull(sut.resolve(makeLibraryStrategy(VALID_LONG, null))); assertNotNull(sut.resolve(makeLibraryStrategy(null, VALID_STRING))); assertNull(sut.resolve((LibraryStrategyType) null)); assertNull(sut.resolve(makeLibraryStrategy(null, null))); assertNull(sut.resolve(makeLibraryStrategy(INVALID_LONG, null))); assertNull(sut.resolve(makeLibraryStrategy(null, INVALID_STRING))); }
@Test public void testResolveLibraryType() { assertNotNull(sut.resolve(makeLibraryType(VALID_LONG, null, null))); assertNotNull(sut.resolve(makeLibraryType(null, "Illumina", VALID_STRING))); assertNull(sut.resolve((LibraryType) null)); assertNull(sut.resolve(makeLibraryType(null, null, null))); assertNull(sut.resolve(makeLibraryType(INVALID_LONG, null, null))); assertNull(sut.resolve(makeLibraryType(null, INVALID_STRING, INVALID_STRING))); assertNull(sut.resolve(makeLibraryType(null, "Illumina", null))); assertNull(sut.resolve(makeLibraryType(null, null, VALID_STRING))); }
@Test public void testResolveLibraryDesign() { assertNotNull(sut.resolve(makeLibraryDesign(VALID_LONG, null))); assertNotNull(sut.resolve(makeLibraryDesign(null, VALID_STRING))); assertNull(sut.resolve((LibraryDesign) null)); assertNull(sut.resolve(makeLibraryDesign(null, null))); assertNull(sut.resolve(makeLibraryDesign(INVALID_LONG, null))); assertNull(sut.resolve(makeLibraryDesign(null, INVALID_STRING))); }
@Test public void testResolveLibraryDesignCode() { assertNotNull(sut.resolve(makeLibraryDesignCode(VALID_LONG, null))); assertNotNull(sut.resolve(makeLibraryDesignCode(null, VALID_STRING))); assertNull(sut.resolve((LibraryDesignCode) null)); assertNull(sut.resolve(makeLibraryDesignCode(null, null))); assertNull(sut.resolve(makeLibraryDesignCode(INVALID_LONG, null))); assertNull(sut.resolve(makeLibraryDesignCode(null, INVALID_STRING))); }
@Test public void testResolveIndex() { assertNotNull(sut.resolve(makeIndex(VALID_LONG, null, null))); assertNotNull(sut.resolve(makeIndex(null, VALID_STRING, VALID_STRING))); assertNull(sut.resolve((Index) null)); assertNull(sut.resolve(makeIndex(null, null, null))); assertNull(sut.resolve(makeIndex(INVALID_LONG, null, null))); assertNull(sut.resolve(makeIndex(null, INVALID_STRING, INVALID_STRING))); assertNull(sut.resolve(makeIndex(null, VALID_STRING, null))); assertNull(sut.resolve(makeIndex(null, null, VALID_STRING))); }
@Test public void testResolveSequencer() { assertNotNull(sut.resolve(makeSequencer(VALID_LONG, null))); assertNotNull(sut.resolve(makeSequencer(null, VALID_STRING))); assertNull(sut.resolve((Instrument) null)); assertNull(sut.resolve(makeSequencer(null, null))); assertNull(sut.resolve(makeSequencer(INVALID_LONG, null))); assertNull(sut.resolve(makeSequencer(null, INVALID_STRING))); }
@Test public void testResolveDetailedQcStatus() { assertNotNull(sut.resolve(makeDetailedQcStatus(VALID_LONG, null))); assertNotNull(sut.resolve(makeDetailedQcStatus(null, VALID_STRING))); assertNull(sut.resolve((DetailedQcStatus) null)); assertNull(sut.resolve(makeDetailedQcStatus(null, null))); assertNull(sut.resolve(makeDetailedQcStatus(INVALID_LONG, null))); assertNull(sut.resolve(makeDetailedQcStatus(null, INVALID_STRING))); }
@Test public void testResolveSubproject() { assertNotNull(sut.resolve(makeSubproject(VALID_LONG, null))); assertNotNull(sut.resolve(makeSubproject(null, VALID_STRING))); assertNull(sut.resolve((Subproject) null)); assertNull(sut.resolve(makeSubproject(null, null))); assertNull(sut.resolve(makeSubproject(INVALID_LONG, null))); assertNull(sut.resolve(makeSubproject(null, INVALID_STRING))); }
@Test public void testResolveReferenceGenome() throws Exception { assertThat("ref with valid alias", sut.resolve(makeReferenceGenome(VALID_LONG, VALID_STRING)), is(notNullValue())); assertThat("ref with valid alias", sut.resolve(makeReferenceGenome(0, VALID_STRING)), is(notNullValue())); assertThat("ref with valid alias", sut.resolve(makeReferenceGenome(INVALID_LONG, VALID_STRING)), is(notNullValue())); assertThat("ref with non-existent alias", sut.resolve(makeReferenceGenome(0, INVALID_STRING)), is(nullValue())); assertThat("ref with null alias", sut.resolve(makeReferenceGenome(0, null)), is(nullValue())); }
@Test public void testResolveTargetedSequencing() throws Exception { assertNotNull(sut.resolve(makeTargetedSequencing(VALID_LONG, VALID_STRING))); assertNotNull(sut.resolve(makeTargetedSequencing(0, VALID_STRING))); assertNull(sut.resolve(makeTargetedSequencing(0, INVALID_STRING))); assertNull(sut.resolve(makeTargetedSequencing(0, null))); }
@Test public void testResolveBoxUse() throws Exception { assertNotNull(sut.resolve(makeBoxUse(VALID_LONG, VALID_STRING))); assertNotNull(sut.resolve(makeBoxUse(null, VALID_STRING))); assertNull(sut.resolve(makeBoxUse(INVALID_LONG, INVALID_STRING))); assertNull(sut.resolve(makeBoxUse(null, INVALID_STRING))); assertNull(sut.resolve(makeBoxUse(INVALID_LONG, null))); assertNull(sut.resolve(makeBoxUse(null, null))); }
@Test public void testResolveBoxSize() throws Exception { assertNotNull(sut.resolve(makeBoxSize(VALID_LONG, 8, 12, true))); assertNotNull(sut.resolve(makeBoxSize(null, 8, 12, true))); assertNull(sut.resolve(makeBoxSize(null, 1, 12, true))); assertNull(sut.resolve(makeBoxSize(null, 8, 1, true))); assertNull(sut.resolve(makeBoxSize(null, 8, 12, false))); assertNull(sut.resolve(makeBoxSize(VALID_LONG, 1, 12, true))); assertNull(sut.resolve(makeBoxSize(VALID_LONG, 8, 1, true))); assertNull(sut.resolve(makeBoxSize(VALID_LONG, 8, 12, false))); }