GitItem extends Item { public static GitItem ofCommit( RevCommit commit ) { return new GitItem( getId( commit ), getTimeStamp( commit ), getAuthor( commit ), getContent( commit ) ); } GitItem( String id, long timeStamp, String author, String content ); static GitItem ofCommit( RevCommit commit ); String getAuthor(); String getContent(); @Override String toString();  }
@Test public void ofCommit() throws IOException { GitRepository repository = gitRule.create( temporaryFolder.newFolder() ); RevCommit commit = repository.commitFile( "file", "content", "message" ); GitItem actual = GitItem.ofCommit( commit ); assertThat( actual ) .hasId( GitItem.getId( commit ) ) .hasTimeStamp( GitItem.getTimeStamp( commit ) ) .hasContent( GitItem.getContent( commit ) ) .hasAuthor( GitItem.getAuthor( commit ) ); }