Buggy code:
public class CypherQueryBuilderTest { public static final String EXPECTED_INTERACTION_CLAUSE_ALL_INTERACTIONS = CypherQueryBuilderTest . expectedInteractionClause ( InteractUtil . allInteractionsCypherClause ( ) ) ; public static final String EXPECTED_MATCH_CLAUSE = CypherQueryBuilderTest . expectedMatchClause ( CypherQueryBuilderTest . EXPECTED_INTERACTION_CLAUSE_ALL_INTERACTIONS , false ) ; public static final String EXPECTED_MATCH_CLAUSE_SPATIAL = CypherQueryBuilderTest . expectedMatchClause ( CypherQueryBuilderTest . EXPECTED_INTERACTION_CLAUSE_ALL_INTERACTIONS , true ) ; private static String expectedInteractionClause ( String interactions ) { } private static String expectedMatchClause ( String expectedInteractionClause , boolean isSpatial ) { } private static String expectedReplacementString ( String interactionParamName ) { } public static final String EXPECTED_RETURN_CLAUSE = ( ( ( ( ( ( ( ( ( "RETURN<seq2seq4repair_space>sourceTaxon.externalId?<seq2seq4repair_space>as<seq2seq4repair_space>source_taxon_external_id," + ( ( "sourceTaxon.name<seq2seq4repair_space>as<seq2seq4repair_space>source_taxon_name," + "sourceTaxon.path?<seq2seq4repair_space>as<seq2seq4repair_space>source_taxon_path," ) + "sourceSpecimen.lifeStage?<seq2seq4repair_space>as<seq2seq4repair_space>source_specimen_life_stage," ) ) + ( CypherQueryBuilderTest . expectedReplacementString ( "type(interaction)" ) ) ) + "<seq2seq4repair_space>as<seq2seq4repair_space>interaction_type," ) + "targetTaxon.externalId?<seq2seq4repair_space>as<seq2seq4repair_space>target_taxon_external_id," ) + "targetTaxon.name<seq2seq4repair_space>as<seq2seq4repair_space>target_taxon_name," ) + "targetTaxon.path?<seq2seq4repair_space>as<seq2seq4repair_space>target_taxon_path," ) + "targetSpecimen.lifeStage?<seq2seq4repair_space>as<seq2seq4repair_space>target_specimen_life_stage," ) + "loc.latitude?<seq2seq4repair_space>as<seq2seq4repair_space>latitude," ) + "loc.longitude?<seq2seq4repair_space>as<seq2seq4repair_space>longitude," ) + "study.title<seq2seq4repair_space>as<seq2seq4repair_space>study_title" ; public static final String EXPECTED_RETURN_CLAUSE_DISTINCT = ( ( ( ( ( ( ( ( ( "WITH<seq2seq4repair_space>distinct<seq2seq4repair_space>targetTaxon<seq2seq4repair_space>as<seq2seq4repair_space>tTaxon,<seq2seq4repair_space>type(interaction)<seq2seq4repair_space>as<seq2seq4repair_space>iType,<seq2seq4repair_space>sourceTaxon<seq2seq4repair_space>as<seq2seq4repair_space>sTaxon<seq2seq4repair_space>" + ( ( ( "RETURN<seq2seq4repair_space>sTaxon.externalId?<seq2seq4repair_space>as<seq2seq4repair_space>source_taxon_external_id," + "sTaxon.name<seq2seq4repair_space>as<seq2seq4repair_space>source_taxon_name," ) + "sTaxon.path?<seq2seq4repair_space>as<seq2seq4repair_space>source_taxon_path," ) + "NULL<seq2seq4repair_space>as<seq2seq4repair_space>source_specimen_life_stage," ) ) + ( CypherQueryBuilderTest . expectedReplacementString ( "iType" ) ) ) + "<seq2seq4repair_space>as<seq2seq4repair_space>interaction_type," ) + "tTaxon.externalId?<seq2seq4repair_space>as<seq2seq4repair_space>target_taxon_external_id," ) + "tTaxon.name<seq2seq4repair_space>as<seq2seq4repair_space>target_taxon_name," ) + "tTaxon.path?<seq2seq4repair_space>as<seq2seq4repair_space>target_taxon_path," ) + "NULL<seq2seq4repair_space>as<seq2seq4repair_space>target_specimen_life_stage," ) + "NULL<seq2seq4repair_space>as<seq2seq4repair_space>latitude," ) + "NULL<seq2seq4repair_space>as<seq2seq4repair_space>longitude," ) + "NULL<seq2seq4repair_space>as<seq2seq4repair_space>study_title" ; @ Test public void findInteractionForSourceAndTargetTaxaLocations ( ) throws IOException { } @ Test public void interactionReturnTerms ( ) { } @ Test public void findInteractionTypesForTaxon ( ) { } @ Test public void findInteractionForSourceAndTargetTaxaLocationsDistinct ( ) throws IOException { } @ Test public void findInteractionForSourceAndTargetTaxaLocationsDistinctTaxonNamesOnly ( ) throws IOException { } @ Test public void findInteractionForSourceAndTargetTaxaLocationsDistinctTaxonNamesOnlyUsingCommaFields ( ) throws IOException { } protected void assertInteractionForSourceAndTargetTaxaLocationsDistinctTaxonNamesOnly ( Map < String , String [ ] > fieldParams ) { } @ Test public void findInteractionsAccordingToWithTaxa ( ) throws IOException { } @ Test public void findInteractionsAccordingToWithTaxaWithCommaFields ( ) throws IOException { } protected void assertFindInteractionsAccordingToWithTaxa ( Map < String , String [ ] > fieldParams ) { } @ Test public void findInteractionsAccordingToWithTargetTaxaOnly ( ) throws IOException { } @ Test public void findInteractionsAccordingToWithTargetTaxaOnly2 ( ) throws IOException { HashMap < String , String [ ] > params = new HashMap < String , String [ ] > ( ) { } ; CypherQuery query = CypherQueryBuilder . buildInteractionQuery ( params , QueryType . MULTI_TAXON_DISTINCT ) ; assertThat ( query . getQuery ( ) , is ( ( ( ( "START<seq2seq4repair_space>study<seq2seq4repair_space>=<seq2seq4repair_space>node:studies('*:*')<seq2seq4repair_space>WHERE<seq2seq4repair_space>(has(study.externalId)<seq2seq4repair_space>AND<seq2seq4repair_space>study.externalId<seq2seq4repair_space>=~<seq2seq4repair_space>{accordingTo})<seq2seq4repair_space>WITH<seq2seq4repair_space>study<seq2seq4repair_space>" + ( CypherQueryBuilderTest . EXPECTED_MATCH_CLAUSE ) ) + "WHERE<seq2seq4repair_space>(has(targetTaxon.path)<seq2seq4repair_space>AND<seq2seq4repair_space>targetTaxon.path<seq2seq4repair_space>=~<seq2seq4repair_space>'(.*(Arthropoda).*)'<seq2seq4repair_space>)<seq2seq4repair_space>" ) + "WITH<seq2seq4repair_space>distinct<seq2seq4repair_space>targetTaxon<seq2seq4repair_space>as<seq2seq4repair_space>tTaxon,<seq2seq4repair_space>type(interaction)<seq2seq4repair_space>as<seq2seq4repair_space>iType,<seq2seq4repair_space>sourceTaxon<seq2seq4repair_space>as<seq2seq4repair_space>sTaxon<seq2seq4repair_space>RETURN<seq2seq4repair_space>sTaxon.name<seq2seq4repair_space>as<seq2seq4repair_space>source_taxon_name,tTaxon.name<seq2seq4repair_space>as<seq2seq4repair_space>target_taxon_name" ) ) ) ; <START_BUG> assertThat ( query . getParams ( ) . toString ( ) , is ( is ( "{accordingTo=\\\\Qhttp:////inaturalist.org//bla\\\\E,<seq2seq4repair_space>target_taxon_name=path:\\\"Arthropoda\\\"}" ) ) ) ; <END_BUG> } @ Test public void findInteractionsAccordingToWithTargetTaxaOnly3 ( ) throws IOException { } @ Test public void findInteractionsAccordingToWithSourceTaxaOnly ( ) throws IOException { } @ Test public void findInteractionsAccordingToWithSourceTaxaOnlyAndExactMatchOnly ( ) throws IOException { } @ Test public void findInteractionsAccordingToWithSourceTaxaOnlyAndExcludeChildTaxa ( ) throws IOException { } @ Test public void findInteractionsAccordingToWithSourceTaxaOnlyAndExactMatchOnlyIncludeObservations ( ) throws IOException { } @ Test public void findInteractionsAccordingToNoTaxa ( ) throws IOException { } @ Test public void findInteractionsAccordingToMultipleNoTaxa ( ) throws IOException { } @ Test public void findInteractionForSourceAndTargetTaxaLocationsDistinctTaxonNamesOnlyFlippedFields ( ) throws IOException { } @ Test public void findInteractionCountOfEnhydraIncludeObservations ( ) throws IOException { } @ Test public void findTaxaAtLocationsDistinct ( ) throws IOException { } @ Test public void findTaxaAtLocationsDistinctInteractionTypes ( ) throws IOException { } @ Test public void findTaxaAtLocationsDistinctInteractionTypesSpecificFields ( ) throws IOException { } @ Test public void findTaxaAtLocationsDistinctNoSpatialParam ( ) throws IOException { } @ Test public void findTaxaAtLocationsDistinctNoSpatialInteractTypesParam ( ) throws IOException { } @ Test public void findInteractionForLocationOnly ( ) throws IOException { } @ Test public void findInteractionForLocationOnlyDistinct ( ) throws IOException { } @ Test public void findInteractionForSourceAndTargetTaxaNoLocation ( ) throws IOException { } @ Test public void findInteractionForTargetTaxaOnlyNoLocation ( ) throws IOException { } @ Test public void findInteractionForTargetTaxaOnlyByInteractionType ( ) throws IOException { } @ Test public void findInteractionForTargetTaxaOnlyByInteractionTypeDistinct ( ) throws IOException { } @ Test public void findInteractionForTargetTaxaPollinates ( ) throws IOException { } @ Test public void findSymbioticInteractions ( ) throws IOException { } @ Test public void findAnyInteractions ( ) throws IOException { } @ Test ( expected = IllegalArgumentException . class ) public void findInteractionForTargetTaxaOnlyByInteractionTypeNotSupported ( ) throws IOException { } @ Test public void findInteractionForTargetTaxaOnlyByEmptyInteractionTypeNotSupported ( ) throws IOException { } @ Test public void findInteractionForSourceTaxaOnlyNoLocation ( ) throws IOException { } @ Test public void findInteractionNoParams ( ) throws IOException { } @ Test public void findPreysOnWithLocation ( ) throws IOException { } @ Test public void findPlantPreyObservationsWithoutLocation ( ) throws IOException { } @ Test public void findPlantParasiteObservationsWithoutLocation ( ) throws IOException { } @ Test public void findPreyObservationsNoLocation ( ) throws IOException { } @ Test public void findDistinctPreyWithLocation ( ) throws IOException { } @ Test public void findDistinctPlantPreyWithoutLocation ( ) throws IOException { } @ Test public void findDistinctPlantParasiteWithoutLocation ( ) throws IOException { } @ Test public void statsWithBBox ( ) throws IOException { } @ Test public void statsWithBBoxAndSource ( ) throws IOException { } @ Test public void stats ( ) throws IOException { } @ Test public void interactionMatchClauseWithLocationPreysOn ( ) { } protected void assertLocationMatchAndWhereClause ( String clause ) { } @ Test public void interactionMatchClauseWithLocationPreysOn2 ( ) { } @ Test public void interactionMatchClauseWithoutLocationPreysOn ( ) { } }

Fix:
assertThat ( query . getParams ( ) . toString ( ) , is ( is ( "{accordingTo=(\\\\Qhttp:////inaturalist.org//bla\\\\E),<seq2seq4repair_space>target_taxon_name=path:\\\"Arthropoda\\\"}" ) ) ) ;