@Test public void retrieveEntriesFromJournalBkp() throws Exception { mJournalFile.delete(); FileWriter writer = new FileWriter(mJournalBkpFile); writer.write("DIRTY k1\nCLEAN k1 12\n"); writer.close(); LinkedHashMap<String, Entry> entries = mJournal.retrieveEntriesFromJournal(); assertThat(entries.size()).isEqualTo(1); assertThat(entries.get("k1")).isNotEqualTo(null); assertThat(entries.get("k1").isReadable()); }
@Test public void retrieveEntriesFromJournal() throws Exception { FileWriter writer = new FileWriter(mJournalFile); writer.write("DIRTY k1\nCLEAN k1 12\n"); writer.close(); LinkedHashMap<String, Entry> entries = mJournal.retrieveEntriesFromJournal(); assertThat(entries.size()).isEqualTo(1); assertThat(entries.get("k1")).isNotEqualTo(null); assertThat(entries.get("k1").isReadable()); }
@Test public void givenAKnownViscosityWhenWeRetrieveItByAnIncorrectKeyThenTheCorrectViscosityIsNotReturned() throws Exception { Map<String, ViscosityInterpolator> viscosities = new HashMap<>(); StubViscosityInterpolator expectedViscosity = new StubViscosityInterpolator(); viscosities.put("TestKey", expectedViscosity); ViscosityInterpolatorMap collection = new ViscosityInterpolatorMap(viscosities, new StubViscosityInterpolator()); ViscosityInterpolator actualViscosity = collection.getFor("WrongTestKey"); assertThat(actualViscosity).isNotEqualTo(expectedViscosity); }
@Test public void testEquals() { EndlessGrid other = null; assertThat(grid).isEqualTo(grid); assertThat(grid.equals(other)).isFalse(); assertThat(grid.equals(this)).isFalse(); other = new EndlessGrid<>(1, 6, cellFactory); assertThat(grid).isNotEqualTo(other); other = new EndlessGrid<>(3, 1, cellFactory); assertThat(grid).isNotEqualTo(other); other = new EndlessGrid<>(3, 6, cellFactory); other.getCell(1, 1).setState(Cell.STATE_ALIVE); assertThat(grid).isNotEqualTo(other); grid.getCell(1, 1).setState(Cell.STATE_ALIVE); assertThat(grid).isEqualTo(other); } }