@Test public void whenPrimaryInstitutionNameOnlyProvidedOnlyPrimaryInstitutionDisplayed() { form.setInstitutionName("University of Portsmouth"); String derivedQueryString = setupQuery().deriveQueryString(); assertEquals( "current-primary-institution-affiliation-name:university of portsmouth", derivedQueryString); }
@Test public void whenPrimaryInstitutionNameAndPastProvidedBothInstitutionNamesDisplayed() { form.setInstitutionName("University of Portsmouth"); form.setPastInstitutionsSearchable(true); String derivedQueryString = setupQuery().deriveQueryString(); assertEquals( "current-primary-institution-affiliation-name:university of portsmouth OR past-institution-affiliation-name:university of portsmouth", derivedQueryString); }
@Test public void whenAllFieldsExceptOrcidAndCheckProvidedQueryStringDisplaysCorrectPermutations() { form.setFamilyName("Logan"); form.setGivenName("Donald"); form.setInstitutionName("University of Portsmouth"); form.setPastInstitutionsSearchable(false); form.setOtherNamesSearchable(false); String derivedQueryString = setupQuery().deriveQueryString(); assertEquals( "given-names:donald AND family-name:logan AND current-primary-institution-affiliation-name:university of portsmouth", derivedQueryString); }
@Test public void whenOrcidSuppliedAllOtherFieldsIgnored() { form.setOrcid("12-34"); form.setFamilyName("Logan"); form.setGivenName("Donald"); form.setInstitutionName("University of Portsmouth"); form.setPastInstitutionsSearchable(true); form.setOtherNamesSearchable(true); form.setKeyword("orcid"); String derivedQueryString = setupQuery().deriveQueryString(); assertEquals("orcid:12-34", derivedQueryString); }