@Test
public final void testInvalidLocationType() {

    final Location mockedLocRef = mockery.mock(Location.class,
            "invalidType");
    final String id = "locID";
    mockery.checking(new Expectations() {
        {
            allowing(mockedLocRef).getLocationType();
            will(returnValue(LocationType.UNKNOWN));
        }
    });
    mockery.checking(new Expectations() {
        {
            allowing(mockedLocRef).getID();
            will(returnValue(id));
        }
    });
    LocationReferenceHolder result = encodeLocation(mockedLocRef);
    assertFalse(result.isValid());
    // while we're at it we check the toString method of
    // DecoderReturnCode
    assertSame(result.getReturnCode().toString(),
            EncoderReturnCode.INVALID_LOCATION_TYPE.toString());
    assertEquals(result.getID(), id);
    assertNotNull(result.toString());
}