@Test public void whenFamilyNameAndGivenNameProvidedQueryIsAnANDQuery() { form.setFamilyName("Logan"); form.setGivenName("Donald"); form.setOtherNamesSearchable(false); SearchOrcidSolrCriteria solrQuery = setupQuery(); String derivedQueryString = solrQuery.deriveQueryString(); assertEquals("given-names:donald AND family-name:logan", 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); }
@Test public void whenGivenNameAndOtherNameProvidedOtherNamesAlsoDisplayed() { form.setGivenName("Donald"); String derivedQueryString = setupQuery().deriveQueryString(); assertEquals("given-names:donald", derivedQueryString); }