    @Test
    public void testCreateStateListTrimMarkIntersectsSegment() {

        RedundancyCalculator redundancyCalculator =
                new RedundancyCalculator("localhost");

        Layout layout = createNonPresentLayout();

        // node is not present anywhere, trim mark starts from the middle of a second segment ->
        // transfer half of second and third segments
        ImmutableList<MockedSegment> expected =
                ImmutableList.of(
                        new MockedSegment(3L, 3L,
                                createStatus(NOT_TRANSFERRED, Optional.empty())));


        List<TransferSegment> result = redundancyCalculator.createStateList(layout, 3L);

        assertThat(transformListToMock(result)).isEqualTo(expected);

        layout = createPresentLayout();

        expected = ImmutableList.of(
                new MockedSegment(3L, 3L,
                        createStatus(RESTORED, Optional.empty())));

        result = redundancyCalculator.createStateList(layout, 3L);

        assertThat(transformListToMock(result)).isEqualTo(expected);

    }