Commits

Sam Adams  committed b539f81

Working on ATs

  • Participants
  • Parent commits 69fbb94

Comments (0)

Files changed (18)

File acceptance-test-driver/src/main/java/net/chempound/acceptance/dsl/AbstractAcceptanceTest.java

 import com.google.inject.Injector;
 import com.google.inject.Stage;
 import org.apache.commons.io.FileUtils;
+import org.hamcrest.Matcher;
 import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
         }
     }
 
+    public static <T, U extends T> void check(final U target, final Matcher<T>... matchers) {
+
+    }
+
 }

File acceptance-test-driver/src/main/java/net/chempound/acceptance/dsl/driver/APIDriver.java

         this.client = new DefaultChempoundClient();
     }
     
-    public CreateCollection createCollection() {
-        return new CreateCollection(this);
+    public CreateCollectionInstruction createCollection() {
+        return new CreateCollectionInstruction(this);
     }
 
-    Collection createCollection(final CreateCollection config) {
+    Collection createCollection(final CreateCollectionInstruction config) {
         final CreateCollectionRequest request = new CreateCollectionRequest()
             .withUri(config.parent != null ? config.parent : URI.create("http://localhost:12345/chempound/content/"))
             .withTitle(context.actual(config.title))
         return new Collection(response.getUri(), response.getTitle());
     }
 
-    public DepositItem newItem() {
-        return new DepositItem(this);
+    public DepositInstruction depositItem() {
+        return new DepositInstruction(this);
     }
 
-    Item depositItem(final DepositItem config) {
+    DepositReceipt depositItem(final DepositInstruction config) {
         final DepositItemRequest request = new DepositItemRequest()
             .withUri(config.parent != null ? config.parent : URI.create("http://localhost:12345/chempound/content/"))
             .withTitle(context.actual(config.title))
             .withSlug(context.actual(config.slug));
 
-        if (config.file != null) {
-            request.addResource(createResource(config.file));
+        if (config.files != null) {
+            for (final Resource file : config.files) {
+                request.addResource(createResource(file));
+            }
         }
 
         final DepositItemResponse response;
             throw new RuntimeException(e);
         }
 
-        return new Item(response.getUri());
+        return new DepositReceipt(response.getTitle(), response.getSplashPage(), response.getEditLink(),
+                                  response.getEditMediaLink(), response.getDerivedResources());
     }
 
     private static LocalResource createResource(final Resource file) {

File acceptance-test-driver/src/main/java/net/chempound/acceptance/dsl/driver/CreateCollection.java

-package net.chempound.acceptance.dsl.driver;
-
-import java.net.URI;
-
-/**
- * @author Sam Adams
- */
-public class CreateCollection {
-
-    private final APIDriver driver;
-
-    URI parent;
-    String title;
-    String slug;
-
-    CreateCollection(final APIDriver driver) {
-        this.driver = driver;
-    }
-
-    public CreateCollection withParent(final Collection parent) {
-        this.parent = parent.getUri();
-        return this;
-    }
-
-    public CreateCollection withTitle(final String title) {
-        this.title = title;
-        return this;
-    }
-
-    public CreateCollection withSlug(final String slug) {
-        this.slug = slug;
-        return this;
-    }
-
-    public Collection execute() {
-        return driver.createCollection(this);
-    }
-
-}

File acceptance-test-driver/src/main/java/net/chempound/acceptance/dsl/driver/CreateCollectionInstruction.java

+package net.chempound.acceptance.dsl.driver;
+
+import java.net.URI;
+
+/**
+ * @author Sam Adams
+ */
+public class CreateCollectionInstruction {
+
+    private final APIDriver driver;
+
+    URI parent;
+    String title;
+    String slug;
+
+    CreateCollectionInstruction(final APIDriver driver) {
+        this.driver = driver;
+    }
+
+    public CreateCollectionInstruction withParent(final Collection parent) {
+        this.parent = parent.getUri();
+        return this;
+    }
+
+    public CreateCollectionInstruction withTitle(final String title) {
+        this.title = title;
+        return this;
+    }
+
+    public CreateCollectionInstruction withSlug(final String slug) {
+        this.slug = slug;
+        return this;
+    }
+
+    public Collection execute() {
+        return driver.createCollection(this);
+    }
+
+}

File acceptance-test-driver/src/main/java/net/chempound/acceptance/dsl/driver/DepositInstruction.java

+package net.chempound.acceptance.dsl.driver;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Sam Adams
+ */
+public class DepositInstruction {
+
+    private final APIDriver driver;
+
+    URI parent;
+    String title;
+    String slug;
+    boolean multipart;
+    List<Resource> files;
+    boolean inProgress;
+
+    DepositInstruction(final APIDriver driver) {
+        this.driver = driver;
+    }
+
+    public DepositInstruction withParent(final Collection parent) {
+        this.parent = parent.getUri();
+        return this;
+    }
+
+    public DepositInstruction withTitle(final String title) {
+        this.title = title;
+        return this;
+    }
+
+    public DepositInstruction withSlug(final String slug) {
+        this.slug = slug;
+        return this;
+    }
+
+    public DepositInstruction multipart(final boolean multipart) {
+        this.multipart = multipart;
+        return this;
+    }
+
+    public DepositInstruction withFile(final Resource file) {
+        if (this.files == null) {
+            this.files = new ArrayList<Resource>();
+        }
+        this.files.add(file);
+        return this;
+    }
+
+    public DepositInstruction withInProgress(final boolean inProgress)
+    {
+        this.inProgress = inProgress;
+        return this;
+    }
+
+    public DepositReceipt execute() {
+        return driver.depositItem(this);
+    }
+}

File acceptance-test-driver/src/main/java/net/chempound/acceptance/dsl/driver/DepositItem.java

-package net.chempound.acceptance.dsl.driver;
-
-import java.net.URI;
-
-/**
- * @author Sam Adams
- */
-public class DepositItem {
-
-    private final APIDriver driver;
-
-    URI parent;
-    String title;
-    String slug;
-    boolean multipart;
-    Resource file;
-
-    DepositItem(final APIDriver driver) {
-        this.driver = driver;
-    }
-
-    public DepositItem withParent(final Collection parent) {
-        this.parent = parent.getUri();
-        return this;
-    }
-
-    public DepositItem withTitle(final String title) {
-        this.title = title;
-        return this;
-    }
-
-    public DepositItem withSlug(final String slug) {
-        this.slug = slug;
-        return this;
-    }
-
-    public DepositItem multipart(final boolean multipart) {
-        this.multipart = multipart;
-        return this;
-    }
-
-    public DepositItem withFile(final Resource file) {
-        this.file = file;
-        return this;
-    }
-
-    public Item execute() {
-        return driver.depositItem(this);
-    }
-}

File acceptance-test-driver/src/main/java/net/chempound/acceptance/dsl/driver/DepositReceipt.java

+package net.chempound.acceptance.dsl.driver;
+
+import org.apache.abdera.i18n.iri.IRI;
+import org.apache.abdera.model.Link;
+import org.junit.Assert;
+
+import java.net.URI;
+import java.util.List;
+
+/**
+ * @author Sam Adams
+ */
+public class DepositReceipt implements ItemView {
+
+    private final String title;
+    private final URI uri;
+    private final Link editLink;
+    private final Link editMediaLink;
+    private final List<Link> derivedResources;
+
+    public DepositReceipt(final String title, final URI uri, final Link editLink, final Link editMediaLink, final List<Link> derivedResources) {
+        this.title = title;
+        this.uri = uri;
+        this.editLink = editLink;
+        this.editMediaLink = editMediaLink;
+        this.derivedResources = derivedResources;
+    }
+
+    public URI getUri() {
+        return uri;
+    }
+
+    public Link getEditMediaLink() {
+        return editMediaLink;
+    }
+
+    public IRI getMediaResourceIri() {
+        Assert.fail();
+        return null;
+    }
+
+    public IRI getSwordEditIri() {
+        Assert.fail();
+        return null;
+    }
+
+    public IRI getSwordStatementIri() {
+        Assert.fail();
+        // http://purl.org/net/sword/terms/statement
+        return null;
+    }
+
+    public IRI getAlternateResources() {
+        Assert.fail();;
+        // http://purl.org/net/sword/terms/originalDeposit
+        return null;
+    }
+
+    public IRI getDerivedResources() {
+        Assert.fail();
+        // ttp://purl.org.net/sword/terms/derivedResource
+        return null;
+    }
+
+
+    @Override
+    public boolean hasTitle(final String title) {
+        return title.equals(title);
+    }
+
+    @Override
+    public boolean hasFiles(final String... files) {
+        if (derivedResources.size() != files.length) {
+            return false;
+        }
+        for (final String file : files) {
+            boolean found = false;
+            for (final Link link : derivedResources) {
+                if (link.getResolvedHref().toString().endsWith('/' + file)) {
+                    found = true;
+                }
+            }
+            if (!found) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    @Override
+    public boolean hasSlug(final String slug) {
+        return uri.toString().contains(slug);
+    }
+}

File acceptance-test-driver/src/main/java/net/chempound/acceptance/dsl/driver/Item.java

-package net.chempound.acceptance.dsl.driver;
-
-import java.net.URI;
-
-/**
- * @author Sam Adams
- */
-public class Item {
-
-    private final URI uri;
-
-    public Item(final URI uri) {
-        this.uri = uri;
-    }
-
-    public URI getUri() {
-        return uri;
-    }
-
-}

File acceptance-test-driver/src/main/java/net/chempound/acceptance/dsl/driver/ItemMatchers.java

 import org.hamcrest.Matcher;
 import org.hamcrest.TypeSafeMatcher;
 
+import java.util.Arrays;
+
 /**
  * @author Sam Adams
  */
         return new ItemTitleMatcher(title);
     }
 
-    public static Matcher<ItemView> hasFileLink(final String file) {
-        return new ItemFileLinkMatcher(file);
+    public static Matcher<ItemView> hasFiles(final String... files) {
+        return new ItemFileLinkMatcher(files);
     }
 
     private static class ItemSlugMatcher extends TypeSafeMatcher<ItemView> {
 
         @Override
         protected boolean matchesSafely(final ItemView item) {
-            return item.matchesTitle(title);
+            return item.hasTitle(title);
         }
 
         @Override
 
     private static class ItemFileLinkMatcher extends TypeSafeMatcher<ItemView> {
 
-        private final String file;
+        private final String[] files;
 
-        public ItemFileLinkMatcher(final String file) {
-            this.file = file;
+        public ItemFileLinkMatcher(final String... files) {
+            this.files = files;
         }
 
         @Override
         protected boolean matchesSafely(final ItemView item) {
-            return item.matchesFileLink(file);
+            return item.hasFiles(files);
         }
 
         @Override
         public void describeTo(final Description description) {
-            description.appendText("contains file '" + file + "'");
+            description.appendText("contains file '" + Arrays.toString(files) + "'");
         }
     }
 }

File acceptance-test-driver/src/main/java/net/chempound/acceptance/dsl/driver/ItemPage.java

     }
 
     @Override
-    public boolean matchesTitle(final String title) {
+    public boolean hasTitle(final String title) {
         final WebElement element = webDriver.findElement(By.cssSelector(".item h1.title"));
         return context.actual(title).equals(element.getText());
     }
 
     @Override
-    public boolean matchesFileLink(final String file) {
-        final URI uri = URI.create(webDriver.getCurrentUrl()).resolve(file);
-        final WebElement element = webDriver.findElement(By.xpath("//a[@href='" + uri + "']"));
-        return element != null;
+    public boolean hasFiles(final String... files) {
+        for (final String file : files) {
+            final URI uri = URI.create(webDriver.getCurrentUrl()).resolve(file);
+            final WebElement element = webDriver.findElement(By.xpath("//a[@href='" + uri + "']"));
+            if (element == null) {
+                return false;
+            }
+        }
+        return true;
     }
 
     @Override

File acceptance-test-driver/src/main/java/net/chempound/acceptance/dsl/driver/ItemView.java

  */
 public interface ItemView {
 
-    boolean matchesTitle(String title);
+    boolean hasTitle(String title);
 
-    boolean matchesFileLink(String file);
+    boolean hasFiles(String... file);
 
     boolean hasSlug(String slug);
 }

File acceptance-test-driver/src/main/java/net/chempound/acceptance/dsl/driver/WebUIDriver.java

         }
     }
 
-    public void check(final Item item, final Matcher<ItemView>... matchers) {
+    public void check(final DepositReceipt item, final Matcher<ItemView>... matchers) {
         loadPage(item.getUri());
 
         webDriver.findElement(By.cssSelector(".item"));

File acceptance-tests/src/test/java/net/chempound/acceptance/CollectionAcceptanceTest.java

-package net.chempound.acceptance;
-
-import net.chempound.acceptance.dsl.AbstractAcceptanceTest;
-import net.chempound.acceptance.dsl.driver.APIDriver;
-import net.chempound.acceptance.dsl.driver.Collection;
-import net.chempound.acceptance.dsl.driver.WebUIDriver;
-import org.junit.Before;
-import org.junit.Test;
-
-import static net.chempound.acceptance.dsl.driver.CollectionMatchers.*;
-
-/**
- * @author Sam Adams
- */
-public class CollectionAcceptanceTest extends AbstractAcceptanceTest {
-
-    private WebUIDriver webDriver;
-    private APIDriver apiDriver;
-
-    @Before
-    public void setUp() throws Exception {
-        webDriver = driverFactory.createWebUIDriver();
-        apiDriver = driverFactory.createAPIDriver();
-    }
-
-    @Test
-    @SuppressWarnings("unchecked")
-    public void shouldCreateCollectionWithTitle() throws Exception {
-        Collection collection = apiDriver.createCollection()
-            .withTitle("title")
-            .execute();
-
-        webDriver.check(collection, hasTitle("title"));
-    }
-
-    @Test
-    @SuppressWarnings("unchecked")
-    public void shouldCreateCollectionWithSlug() throws Exception {
-        Collection collection = apiDriver.createCollection()
-            .withSlug("slug")
-            .withTitle("title")
-            .execute();
-
-        webDriver.check(collection, hasTitle("title"), hasSlug("slug"));
-    }
-
-    @Test
-    @SuppressWarnings("unchecked")
-    public void shouldLinkFromParentToChildCollection() throws Exception {
-        Collection parent = apiDriver.createCollection()
-            .execute();
-        
-        Collection child = apiDriver.createCollection()
-            .withParent(parent)
-            .withTitle("child-title")
-            .execute();
-
-        webDriver.check(parent, containsItem(child));
-    }
-
-}

File acceptance-tests/src/test/java/net/chempound/acceptance/DepositAcceptanceTest.java

-package net.chempound.acceptance;
-
-import net.chempound.acceptance.dsl.AbstractAcceptanceTest;
-import net.chempound.acceptance.dsl.driver.APIDriver;
-import net.chempound.acceptance.dsl.driver.Item;
-import net.chempound.acceptance.dsl.driver.Resource;
-import net.chempound.acceptance.dsl.driver.WebUIDriver;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.util.Random;
-
-import static net.chempound.acceptance.dsl.driver.ItemMatchers.*;
-
-/**
- * @author Sam Adams
- */
-public class DepositAcceptanceTest extends AbstractAcceptanceTest {
-
-    private WebUIDriver webDriver;
-    private APIDriver apiDriver;
-
-    @Before
-    public void setUp() throws Exception {
-        webDriver = driverFactory.createWebUIDriver();
-        apiDriver = driverFactory.createAPIDriver();
-    }
-
-    @Test
-    @SuppressWarnings("unchecked")
-    public void shouldCreateItemOnMetadataDeposit() {
-        Item item = apiDriver.newItem()
-            .withSlug("slug")
-            .withTitle("title")
-            .execute();
-
-        webDriver.check(item, hasSlug("slug"), hasTitle("title"));
-    }
-
-    @Test
-    @SuppressWarnings("unchecked")
-    public void shouldCreateItemOnBinaryDeposit() {
-        Resource file = newResource();
-        
-        Item item = apiDriver.newItem()
-            .withFile(file)
-            .execute();
-
-        webDriver.check(item, hasFileLink(file.getPath()));
-    }
-
-    @Test
-    @SuppressWarnings("unchecked")
-    public void shouldCreateItemOnMultipartDeposit() {
-        Resource file = newResource();
-
-        Item item = apiDriver.newItem()
-                     .withTitle("title")
-                     .withFile(file)
-                     .multipart(true)
-                     .execute();
-
-        webDriver.check(item, hasTitle("title"), hasFileLink(file.getPath()));
-    }
-
-    private static Resource newResource() {
-        return new Resource("path", "mime/type", generateContent());
-    }
-
-    private static byte[] generateContent() {
-        byte[] bytes = new byte[1024];
-        new Random().nextBytes(bytes);
-        return bytes;
-    }
-
-}

File acceptance-tests/src/test/java/net/chempound/acceptance/sword/DepositAcceptanceTest.java

+package net.chempound.acceptance.sword;
+
+import net.chempound.acceptance.dsl.AbstractAcceptanceTest;
+import net.chempound.acceptance.dsl.driver.APIDriver;
+import net.chempound.acceptance.dsl.driver.DepositReceipt;
+import net.chempound.acceptance.dsl.driver.Resource;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import java.util.Random;
+
+import static net.chempound.acceptance.dsl.driver.ItemMatchers.*;
+
+/**
+ * @author Sam Adams
+ */
+public class DepositAcceptanceTest extends AbstractAcceptanceTest {
+
+    private APIDriver apiDriver;
+
+    @Before
+    public void setUp() throws Exception {
+        apiDriver = driverFactory.createAPIDriver();
+    }
+
+    @Test
+    @SuppressWarnings("unchecked")
+    public void shouldCreateItemOnMetadataOnlDeposit() {
+        DepositReceipt item = apiDriver.depositItem()
+            .withSlug("slug")
+            .withTitle("title")
+            .execute();
+
+        check(item, hasTitle("title"), hasSlug("slug"));
+    }
+
+    @Test
+    @SuppressWarnings("unchecked")
+    public void shouldCreateItemOnBinaryDeposit() {
+        Resource file = newResource("file");
+        
+        DepositReceipt item = apiDriver.depositItem()
+            .withFile(file)
+            .execute();
+
+        check(item, hasFiles(file.getPath()));
+    }
+
+    @Test
+    @SuppressWarnings("unchecked")
+    public void shouldCreateItemOnBinaryDepositWithMultipleFiles() {
+        Resource file1 = newResource("file1");
+        Resource file2 = newResource("file2");
+        Resource file3 = newResource("file3");
+
+        DepositReceipt item = apiDriver.depositItem()
+                               .withFile(file1)
+                               .withFile(file2)
+                               .withFile(file3)
+                               .execute();
+
+        check(item, hasFiles(file1.getPath(), file2.getPath(), file3.getPath()));
+    }
+
+    @Test
+    @SuppressWarnings("unchecked")
+    public void shouldCreateItemOnMultipartDeposit() {
+        Resource file = newResource("file");
+
+        DepositReceipt item = apiDriver.depositItem()
+                     .withTitle("title")
+                     .withFile(file)
+                     .multipart(true)
+                     .execute();
+
+        check(item, hasTitle("title"), hasFiles(file.getPath()));
+    }
+
+    @Test
+    @SuppressWarnings("unchecked")
+    public void shouldCreateItemOnMultipartDepositWithMultipleFiles() {
+        Resource file1 = newResource("file1");
+        Resource file2 = newResource("file2");
+        Resource file3 = newResource("file3");
+
+        DepositReceipt item = apiDriver.depositItem()
+                               .withTitle("title")
+                               .withFile(file1)
+                               .withFile(file2)
+                               .withFile(file3)
+                               .multipart(true)
+                               .execute();
+
+        check(item, hasTitle("title"), hasFiles(file1.getPath(), file2.getPath(), file3.getPath()));
+    }
+
+    @Test
+    @Ignore
+    public void shouldSupportInProgressDeposit() {
+        DepositReceipt item = apiDriver.depositItem()
+                     .withTitle("title")
+                     .withInProgress(true)
+                     .execute();
+
+        Assert.fail("work in progress");
+    }
+
+    private Resource newResource(final String path) {
+        return new Resource(testContext.actual(path), "mime/type", generateContent());
+    }
+
+    private static byte[] generateContent() {
+        byte[] bytes = new byte[1024];
+        new Random().nextBytes(bytes);
+        return bytes;
+    }
+
+}

File acceptance-tests/src/test/java/net/chempound/acceptance/sword/SwordStatementAcceptanceTest.java

+package net.chempound.acceptance.sword;
+
+import net.chempound.acceptance.dsl.AbstractAcceptanceTest;
+import net.chempound.acceptance.dsl.driver.APIDriver;
+import org.junit.Before;
+
+/**
+ * @author Sam Adams
+ */
+public class SwordStatementAcceptanceTest extends AbstractAcceptanceTest {
+
+    private APIDriver apiDriver;
+
+    @Before
+    public void setUp() throws Exception {
+        apiDriver = driverFactory.createAPIDriver();
+    }
+
+}

File acceptance-tests/src/test/java/net/chempound/acceptance/ui/CollectionAcceptanceTest.java

+package net.chempound.acceptance.ui;
+
+import net.chempound.acceptance.dsl.AbstractAcceptanceTest;
+import net.chempound.acceptance.dsl.driver.APIDriver;
+import net.chempound.acceptance.dsl.driver.Collection;
+import net.chempound.acceptance.dsl.driver.WebUIDriver;
+import org.junit.Before;
+import org.junit.Test;
+
+import static net.chempound.acceptance.dsl.driver.CollectionMatchers.*;
+
+/**
+ * @author Sam Adams
+ */
+public class CollectionAcceptanceTest extends AbstractAcceptanceTest {
+
+    private WebUIDriver webDriver;
+    private APIDriver apiDriver;
+
+    @Before
+    public void setUp() throws Exception {
+        webDriver = driverFactory.createWebUIDriver();
+        apiDriver = driverFactory.createAPIDriver();
+    }
+
+    @Test
+    @SuppressWarnings("unchecked")
+    public void shouldCreateCollectionWithTitle() throws Exception {
+        Collection collection = apiDriver.createCollection()
+            .withTitle("title")
+            .execute();
+
+        webDriver.check(collection, hasTitle("title"));
+    }
+
+    @Test
+    @SuppressWarnings("unchecked")
+    public void shouldCreateCollectionWithSlug() throws Exception {
+        Collection collection = apiDriver.createCollection()
+            .withSlug("slug")
+            .withTitle("title")
+            .execute();
+
+        webDriver.check(collection, hasTitle("title"), hasSlug("slug"));
+    }
+
+    @Test
+    @SuppressWarnings("unchecked")
+    public void shouldLinkFromParentToChildCollection() throws Exception {
+        Collection parent = apiDriver.createCollection()
+            .execute();
+        
+        Collection child = apiDriver.createCollection()
+            .withParent(parent)
+            .withTitle("child-title")
+            .execute();
+
+        webDriver.check(parent, containsItem(child));
+    }
+
+}

File acceptance-tests/src/test/java/net/chempound/acceptance/ui/WebUIAcceptanceTest.java

+package net.chempound.acceptance.ui;
+
+import net.chempound.acceptance.dsl.AbstractAcceptanceTest;
+import net.chempound.acceptance.dsl.driver.APIDriver;
+import net.chempound.acceptance.dsl.driver.DepositReceipt;
+import net.chempound.acceptance.dsl.driver.Resource;
+import net.chempound.acceptance.dsl.driver.WebUIDriver;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.util.Random;
+
+import static net.chempound.acceptance.dsl.driver.ItemMatchers.*;
+
+/**
+ * @author Sam Adams
+ */
+public class WebUIAcceptanceTest extends AbstractAcceptanceTest {
+
+    private WebUIDriver webDriver;
+    private APIDriver apiDriver;
+
+    @Before
+    public void setUp() throws Exception {
+        webDriver = driverFactory.createWebUIDriver();
+        apiDriver = driverFactory.createAPIDriver();
+    }
+
+    @Test
+    @SuppressWarnings("unchecked")
+    public void shouldCreateItemOnMetadataDeposit() {
+        DepositReceipt item = apiDriver.depositItem()
+            .withSlug("slug")
+            .withTitle("title")
+            .execute();
+
+        webDriver.check(item, hasSlug("slug"), hasTitle("title"));
+    }
+
+    @Test
+    @SuppressWarnings("unchecked")
+    public void shouldCreateItemOnBinaryDeposit() {
+        Resource file = newResource();
+        
+        DepositReceipt item = apiDriver.depositItem()
+            .withFile(file)
+            .execute();
+
+        webDriver.check(item, hasFiles(file.getPath()));
+    }
+
+    @Test
+    @SuppressWarnings("unchecked")
+    public void shouldCreateItemOnMultipartDeposit() {
+        Resource file = newResource();
+
+        DepositReceipt item = apiDriver.depositItem()
+                     .withTitle("title")
+                     .withFile(file)
+                     .multipart(true)
+                     .execute();
+
+        webDriver.check(item, hasTitle("title"), hasFiles(file.getPath()));
+    }
+
+    private static Resource newResource() {
+        return new Resource("path", "mime/type", generateContent());
+    }
+
+    private static byte[] generateContent() {
+        byte[] bytes = new byte[1024];
+        new Random().nextBytes(bytes);
+        return bytes;
+    }
+
+}