Skip to content

Commit

Permalink
Update the EmployeeSubject example to use a plural name for the stati…
Browse files Browse the repository at this point in the history
…c factory method, as per Java API Review.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=128501126
  • Loading branch information
kluever authored and cpovirk committed Jul 27, 2016
1 parent 03d032e commit 2becf03
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static EmployeeSubject assertThat(@Nullable Employee employee) {
}

// Static method for getting the subject factory (for use with assertAbout())
public static SubjectFactory<EmployeeSubject, Employee> employee() {
public static SubjectFactory<EmployeeSubject, Employee> employees() {
return EMPLOYEE_SUBJECT_FACTORY;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@
*/
package com.google.common.truth.extension;

import static com.google.common.truth.Truth.assertAbout;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.extension.Employee.Location;
import static com.google.common.truth.extension.EmployeeSubject.assertThat;
import static com.google.common.truth.extension.EmployeeSubject.employee;
import static com.google.common.truth.extension.EmployeeSubject.employees;

import com.google.common.truth.extension.Employee.Location;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
Expand All @@ -45,8 +46,10 @@ public void kurt() {
assertThat(KURT).hasId(37802);
assertThat(KURT).hasUsername("kak");
assertThat(KURT).hasName("Kurt Alfred Kluever");
assertThat(KURT).hasLocation(Location.NYC);
assertThat(KURT).isNotCeo();

// These assertions use assertAbout and the EmployeeSubject static factory method
assertAbout(employees()).that(KURT).isNotCeo();
assertAbout(employees()).that(KURT).hasLocation(Location.NYC);
}

@Test
Expand Down

0 comments on commit 2becf03

Please sign in to comment.