DiskObjectRepository implements ObjectRepository { public void saveObject(Object objectToBeSerialized, OutputStream outputStream) throws IOException { new ObjectOutputStream(outputStream).writeObject(objectToBeSerialized); }  void saveObject(Object objectToBeSerialized, OutputStream outputStream); Object getObject(InputStream inputStream); boolean objectAlreadyExist(String objectId, String location); void saveObject(Object object, String objectId, String location); Object getObject(String objectId, String location); @Override boolean clearObjectIfAvailable(String objectId, String location);  }
@SuppressWarnings("unchecked") @Test public void shouldRecordObj() throws Exception { objectRepository.saveObject(Arrays.asList("sandy", "ganesh", 12, 23.0), outputStream); verify(outputStream, new Times(14)).write((byte[]) any(), anyInt(), anyInt()); }
@Test public void shouldSaveObject() throws Exception { String locationDirectory = getAbsolutePath("src", "test", "resources", "com", "svashishtha","mocktail", "util"); File file = new File(locationDirectory, "saved_object"); assertThat(file.exists(), is(false)); objectRepository.saveObject(Arrays.asList("sandy", "ganesh", 12, 23.0), "saved_object", locationDirectory); file = new File(locationDirectory, "saved_object"); assertThat(file.exists(), is(true)); assertThat("Unable to delete file", true, is(file.delete())); }