*Null hypothesis*that "the sample comes from an exp(1) distribution"

**against**the

*alternative hypothesis*"the sample do not comes from an exp(1) distribution? I wrote the following code in R, is this right?

> observed<-z # I generated m = 500 random values from exp(1) distribution

> prob.exp<-dexp(z)

> prob.exp<-dexp(z,rate=1)

> chisq.test(observed,p=prob.exp,rescale.p=TRUE)

Chi-squared test for given probabilities

data: observed

X-squared = 40909, df = 499, p-value < 2.2e-16

Warning message:

In chisq.test(observed, p = prob.exp, rescale.p = TRUE) :

Chi-squared approximation may be incorrect

How can I test the same hypothesis with Kolmogorov-Smirnov test?