class VufsServiceImpl implements IVufsService {

    @Override
    public AllocationStrategy getAllocationStrategyByMetafileUuid(String metafileUuid)
            throws MetafileDoesNotExistException {
        for (Metafile metafile : currentMetatable.getMetafileSet()) {
            if (metafile.getFileUuid().equalsIgnoreCase(metafileUuid)) {
                return metafile.getAllocationStrategy();
            }
        }
        throw new MetafileDoesNotExistException(getExceptionInfo(currentMetatable, metafileUuid,
                "getAllocationStrategyByMetafileUuid"));
    }

}

class VufsServiceImplTest {

    private IVufsService vufsService;

    @Test(expected = MetafileDoesNotExistException.class)
    public void getAllocationStrategyByMetafileUuidWithException()
            throws MetafileDoesNotExistException {

        //here throw exception
        AllocationStrategy result = vufsService
                .getAllocationStrategyByMetafileUuid(UUID.randomUUID().toString());
    }

}