@Test public void testStoreEntryWhenMarshallerNotExists() throws Exception { Object value = mock(Object.class); when(marshallerRegistry.get(value.getClass())).thenReturn(null); expectedException.expectMessage("No marshaller was found for class: " + value.getClass()); registryHelper.storeEntry(mock(Path.class), value); }
public void storeEntry(final Path path, final Object value) throws Exception { final Marshaller marshaller = marshallerRegistry.get(value.getClass()); if (marshaller == null) { throw new Exception("No marshaller was found for class: " + value.getClass()); } @SuppressWarnings("unchecked") final String marshalledValue = marshaller.marshal(value); final VFSRegistryEntry entry = new VFSRegistryEntry(value.getClass().getName(), marshalledValue); final String content = entryMarshaller.marshal(entry); writeBatch(path, content); }
VFSRegistryHelper { public void storeEntry(final Path path, final Object value) throws Exception { final Marshaller marshaller = marshallerRegistry.get(value.getClass()); if (marshaller == null) { throw new Exception("No marshaller was found for class: " + value.getClass()); } @SuppressWarnings("unchecked") final String marshalledValue = marshaller.marshal(value); final VFSRegistryEntry entry = new VFSRegistryEntry(value.getClass().getName(), marshalledValue); final String content = entryMarshaller.marshal(entry); writeBatch(path, content); } }
VFSRegistryHelper { public void storeEntry(final Path path, final Object value) throws Exception { final Marshaller marshaller = marshallerRegistry.get(value.getClass()); if (marshaller == null) { throw new Exception("No marshaller was found for class: " + value.getClass()); } @SuppressWarnings("unchecked") final String marshalledValue = marshaller.marshal(value); final VFSRegistryEntry entry = new VFSRegistryEntry(value.getClass().getName(), marshalledValue); final String content = entryMarshaller.marshal(entry); writeBatch(path, content); } VFSRegistryHelper(); @Inject  VFSRegistryHelper(final VFSMarshallerRegistry marshallerRegistry,
                             final @Named("ioStrategy") IOService ioService,
                             final @Named("systemFS") FileSystem fileSystem); }
VFSRegistryHelper { public void storeEntry(final Path path, final Object value) throws Exception { final Marshaller marshaller = marshallerRegistry.get(value.getClass()); if (marshaller == null) { throw new Exception("No marshaller was found for class: " + value.getClass()); } @SuppressWarnings("unchecked") final String marshalledValue = marshaller.marshal(value); final VFSRegistryEntry entry = new VFSRegistryEntry(value.getClass().getName(), marshalledValue); final String content = entryMarshaller.marshal(entry); writeBatch(path, content); } VFSRegistryHelper(); @Inject  VFSRegistryHelper(final VFSMarshallerRegistry marshallerRegistry,
                             final @Named("ioStrategy") IOService ioService,
                             final @Named("systemFS") FileSystem fileSystem); Path ensureDirectory(final String directory); String md5Hex(String content); void storeEntry(final Path path,
                           final Object value); Object readEntry(final Path path); List<Object> readEntries(final Path rootPath,
                                    final DirectoryStream.Filter<Path> filter); void writeBatch(final Path path,
                           final String content); void deleteBatch(final Path path); }
VFSRegistryHelper { public void storeEntry(final Path path, final Object value) throws Exception { final Marshaller marshaller = marshallerRegistry.get(value.getClass()); if (marshaller == null) { throw new Exception("No marshaller was found for class: " + value.getClass()); } @SuppressWarnings("unchecked") final String marshalledValue = marshaller.marshal(value); final VFSRegistryEntry entry = new VFSRegistryEntry(value.getClass().getName(), marshalledValue); final String content = entryMarshaller.marshal(entry); writeBatch(path, content); } VFSRegistryHelper(); @Inject  VFSRegistryHelper(final VFSMarshallerRegistry marshallerRegistry,
                             final @Named("ioStrategy") IOService ioService,
                             final @Named("systemFS") FileSystem fileSystem); Path ensureDirectory(final String directory); String md5Hex(String content); void storeEntry(final Path path,
                           final Object value); Object readEntry(final Path path); List<Object> readEntries(final Path rootPath,
                                    final DirectoryStream.Filter<Path> filter); void writeBatch(final Path path,
                           final String content); void deleteBatch(final Path path);  }