A federal judge has granted a preliminary injunction requested by the Environmental Protection Agency that will force Granger-area dairies to test for nitrates in nearby residential drinking water.