Project

General

Profile

« Previous | Next » 

Revision 55010

Added test method

View differences:

modules/cnr-cql-utils/trunk/src/test/java/eu/dnetlib/functionality/cql/mongo/MongoCqlTranslatorTest.java
137 137
		assertEquals(expected.toBsonDocument(BsonDocument.class, MongoClient.getDefaultCodecRegistry()), filter.toBsonDocument(BsonDocument.class, MongoClient.getDefaultCodecRegistry()));
138 138
	}
139 139

  
140
	@Test
141
	public void testPM_PMCIDQueryNotinPubMedCentral() throws IOException, CQLParseException {
142
		String q = "((pidtype = \"pmc\" or pidtype = \"pmid\") and set <> \"PubMed_Central\" )";
143
		BasicDBObject expected = new BasicDBObject("$and", Lists.newArrayList(new BasicDBObject("$or", Lists.newArrayList(new BasicDBObject("pidtype", "pmc"), new BasicDBObject("pidtype", "pmid"))), new BasicDBObject("set", new BasicDBObject("$ne", "PubMed_Central"))));
144
		Bson o = tr.toMongo(q);
145
		assertEquals(expected, o);
146
	}
147

  
140 148
}

Also available in: Unified diff