class EntityTagHeaderDelegate implements RuntimeDelegate.HeaderDelegate<EntityTag> {

    @Override
    public EntityTag fromString(String header) {
        if (header == null) {
            throw new IllegalArgumentException();
        }

        boolean isWeak = header.startsWith("W/");

        String value;
        if (isWeak) {
            value = cutWeakPrefix(header);
        } else {
            value = header;
        }
        value = value.substring(1, value.length() - 1);
        value = HeaderHelper.removeQuoteEscapes(value);

        return new EntityTag(value, isWeak);
    }

}

class EntityTagHeaderDelegateTest {

    private EntityTagHeaderDelegate entityTagHeaderDelegate;

    @Test
    public void parsesString() {

        EntityTag entityTag = entityTagHeaderDelegate.fromString("\"test\"");

        assertFalse(entityTag.isWeak());
        assertEquals("test", entityTag.getValue());
    }

}