FileStreamer { public EnrichedSessionState createNewSession(final Path file) { AnalysisResult model = analyse(file); return new EnrichedSessionState(new SessionState(model)); } @Inject  FileStreamer(final TextReader textReader, final Analyser analyser); AnalysisResult analyse(final Path file); EnrichedSessionState createNewSession(final Path file); EnrichedSessionState createOrOpenSession(final Path file);  }
@Test public void testEqualSession() { EnrichedSessionState state1 = createNewSession(FILE_TEXT); EnrichedSessionState state2 = createNewSession(FILE_TEXT); assertEquals(state1, state2, "Equal session"); }
@Test public void testDifferentSession() { EnrichedSessionState state1 = createNewSession(FILE_TEXT); EnrichedSessionState state2 = createNewSession(FILE_WORD); assertNotEquals(state1, state2, "Different session"); }
@Test public void testEqualHashCode() { EnrichedSessionState state1 = createNewSession(FILE_TEXT); EnrichedSessionState state2 = createNewSession(FILE_TEXT); assertEquals(state1.hashCode(), state2.hashCode(), "Equal hash code session"); }
@Test public void testSessionToString() { EnrichedSessionState state = createNewSession(FILE_TEXT); assertTrue(StringUtils.isNotBlank(state.toString()), "Session toString"); }