    @Test
    public void testUpdateAttachmentContent() throws FileNotFoundException {

        handler.addRequest("PUT", "/qcbin/rest/domains/domain/projects/project/defects/1/attachments/logfile.txt", 200)
                .expectHeader("Content-Type", "application/octet-stream")
                .content("attachmentServiceTest_attachment.xml");

        handler.async();
        addEntityListener(new EntityLoaded(handler, new EntityLoaded.Listener() {
            @Override
            public void evaluate(Entity entity, EntityListener.Event event) {
                checkAttachment(entity);
                Assert.assertEquals(EntityListener.Event.GET, event);
            }
        }));

        boolean updated = attachmentService.updateAttachmentContent("logfile.txt", new EntityRef("defect", 1), new IndicatingInputStream(file, null), file.length(), false);
        Assert.assertTrue(updated);
    }