Use fest-reflect 1.4.1 to show :

- fest-reflect examples
- compatibility between fest-assert-core 2.0M9, fest-reflect 1.4.1, fest-guava-assert 1.0 and fest-joda-time-assert 1.1.0
This commit is contained in:
Joel Costigliola 2013-02-23 18:15:37 +01:00
parent b00911b12a
commit 488e58336e
3 changed files with 43 additions and 3 deletions

View File

@ -22,7 +22,12 @@
<dependency>
<groupId>org.easytesting</groupId>
<artifactId>fest-assert-core</artifactId>
<version>2.0M8</version>
<version>2.0M9-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.easytesting</groupId>
<artifactId>fest-reflect</artifactId>
<version>1.4.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.easytesting</groupId>

View File

@ -4,8 +4,8 @@ import java.util.Date;
public class Movie {
private final String title;
private final Date releaseDate;
private String title;
private Date releaseDate;
public Movie(String title, Date releaseDate) {
super();
@ -16,6 +16,14 @@ public class Movie {
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public void setReleaseDate(Date releaseDate) {
this.releaseDate = releaseDate;
}
public Date getReleaseDate() {
return releaseDate;

View File

@ -0,0 +1,27 @@
package org.fest.reflect.examples;
import static org.fest.assertions.api.Assertions.assertThat;
import static org.fest.reflect.core.Reflection.constructor;
import static org.fest.reflect.core.Reflection.method;
import java.util.Date;
import org.junit.Test;
import org.fest.assertions.examples.data.Movie;
public class BasicExamples {
@Test
public void constructor_and_method_call_example() throws Exception {
Date date = new Date();
Movie movie = constructor().withParameterTypes(String.class, Date.class).in(Movie.class)
.newInstance("Pulp Fiction", date);
assertThat(movie).isNotNull();
assertThat(movie.getTitle()).isEqualTo("Pulp Fiction");
assertThat(movie.getReleaseDate()).isEqualTo(date);
method("setTitle").withParameterTypes(String.class).in(movie).invoke("Kill Bill");
assertThat(movie.getTitle()).isEqualTo("Kill Bill");
}
}