package com.moonillusions.propertynavigation;

import static com.moonillusions.propertynavigation.PropertyNavigation.of;
import static com.moonillusions.propertynavigation.PropertyNavigation.prop;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;

import org.junit.Test;

public class PropertyNavigationTest {

	@Test
	public void shallow_class() {
		assertThat(prop(of(Book.class).getAuthor()), equalTo("author"));
	}

	@Test
	public void deep_class() {
		assertThat(prop(of(Book.class).getAuthor().getAddress()),
				equalTo("author.address"));
	}

	@Test
	public void shallow_final_class() {
		assertThat(prop(of(Book.class).getPageCount()), equalTo("pageCount"));
	}

	@Test
	public void deep_final_class() {
		assertThat(prop(of(Book.class).getAuthor().getName()),
				equalTo("author.name"));
	}

	@Test
	public void shallow_primitive() {
		assertThat(prop(of(Book.class).getId()), equalTo("id"));
	}

	@Test
	public void deep_primitive() {
		assertThat(prop(of(Book.class).getAuthor().getBookCount()),
				equalTo("author.bookCount"));
	}

}
@@ -279,16 +279,41 @@
 tThat;%0A%0A
+import org.junit.Ignore;%0A
 import o
@@ -1103,9 +1103,171 @@
 ));%0A%09%7D%0A%0A
+%09@Test%0A%09@Ignore%0A%09public void getter_of_final_class() %7B%0A%09%09assertThat(prop(of(Book.class).getAuthor().getName().getBytes()),%0A%09%09%09%09equalTo(%22author.name.bytes%22));%0A%09%7D%0A%0A
 %7D

Test for using final classes in the middle of the path