001/* 002 * The contents of this file are subject to the license and copyright 003 * detailed in the LICENSE and NOTICE files at the root of the source 004 * tree. 005 */ 006package org.fcrepo.http.commons.domain; 007 008import static com.google.common.collect.Sets.newHashSet; 009import static org.junit.Assert.assertEquals; 010import static org.junit.Assert.assertTrue; 011 012import org.junit.Test; 013 014 015/** 016 * @author ajs6f 017 * @since 30 Oct 2014 018 * 019 */ 020public class MultiPreferTest extends SinglePreferTest { 021 022 @Override 023 protected SinglePrefer createTestPreferTypeFromHeader(final String header) { 024 return new MultiPrefer(header); 025 } 026 027 @Test 028 public void testMultiConstructor() { 029 final SinglePrefer first = new SinglePrefer("return=representation"); 030 final SinglePrefer second = new SinglePrefer("handling=strict"); 031 final MultiPrefer testPrefer = new MultiPrefer(newHashSet(first, second)); 032 // check to see that both headers were parsed 033 assertTrue(testPrefer.hasReturn()); 034 assertEquals("representation", testPrefer.getReturn().getValue()); 035 assertTrue(testPrefer.hasHandling()); 036 } 037}