text:
//******************************************************************************************************
//  ChannelFrameParsingStateBase.cs - Gbtc
//
//  Copyright © 2012, Grid Protection Alliance.  All Rights Reserved.
//
//  Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See
//  the NOTICE file distributed with this work for additional information regarding copyright ownership.
//  The GPA licenses this file to you under the MIT License (MIT), the "License"; you may
//  not use this file except in compliance with the License. You may obtain a copy of the License at:
//
//      http://www.opensource.org/licenses/MIT
//
//  Unless agreed to in writing, the subject software distributed under the License is distributed on an
//  "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the
//  License for the specific language governing permissions and limitations.
//
//  Code Modification History:
//  ----------------------------------------------------------------------------------------------------
//  01/14/2005 - J. Ritchie Carroll
//       Generated original version of source code.
//  09/15/2009 - Stephen C. Wills
//       Added new header and license agreement.
//  10/5/2012 - Gavin E. Holden
//       Added new header and license agreement.
//  12/17/2012 - Starlynn Danyelle Gilliam
//       Modified Header.
//
//******************************************************************************************************

using System;

namespace GSF.PhasorProtocols
{
    /// <summary>
    /// Represents the protocol independent common implementation of the parsing state used by any <see cref="IChannelFrame"/>.
    /// </summary>
    /// <typeparam name="T"><see cref="Type"/> of <see cref="IChannelCell"/> referenced by <see cref="IChannelFrame"/> being parsed.</typeparam>
    public abstract class ChannelFrameParsingStateBase<T> : ChannelParsingStateBase, IChannelFrameParsingState<T> where T : IChannelCell
    {
        #region [ Members ]

        // Fields
        private bool m_trustHeaderLength;
        private bool m_validateCheckSum;

        #endregion

        #region [ Constructors ]

        /// <summary>
        /// Creates a new <see cref="ChannelFrameParsingStateBase{T}"/> from specified parameters.
        /// </summary>
        /// <param name="parsedBinaryLength">Binary length of the <see cref="IChannelFrame"/> being parsed.</param>
        /// <param name="createNewCellFunction">Reference to delegate to create new <see cref="IChannelCell"/> instances.</param>
        /// <param name="trustHeaderLength">Determines if header lengths should be trusted over parsed byte count.</param>
        /// <param name="validateCheckSum">Determines if frame's check-sum should be validated.</param>
        protected ChannelFrameParsingStateBase(int parsedBinaryLength, CreateNewCellFunction<T> createNewCellFunction, bool trustHeaderLength, bool validateCheckSum)
        {
            base.ParsedBinaryLength = parsedBinaryLength;
            CreateNewCell = createNewCellFunction;
            m_trustHeaderLength = trustHeaderLength;
            m_validateCheckSum = validateCheckSum;
        }

        #endregion

        #region [ Properties ]

        /// <summary>
        /// Gets reference to delegate used to create a new <see cref="IChannelCell"/> object.
        /// </summary>
        public virtual CreateNewCellFunction<T> CreateNewCell { get; }

        /// <summary>
        /// Gets or sets number of cells that are expected in associated <see cref="IChannelFrame"/> being parsed.
        /// </summary>
        public virtual int CellCount { get; set; }

        /// <summary>
        /// Gets or sets flag that determines if header lengths should be trusted over parsed byte count.
        /// </summary>
        /// <remarks>
        /// It is expected that this will normally be left as <c>true</c>.
        /// </remarks>
        public virtual bool TrustHeaderLength
        {
            get => m_trustHeaderLength;
            set => m_trustHeaderLength = value;
        }

        /// <summary>
        /// Gets or sets flag that determines if frame's check-sum should be validated.
        /// </summary>
        /// <remarks>
        /// It is expected that this will normally be left as <c>true</c>.
        /// </remarks>
        public virtual bool ValidateCheckSum
        {
            get => m_validateCheckSum;
            set => m_validateCheckSum = value;
        }

        #endregion
    }
}


text:
<img src="http://i.imgur.com/ypw29XY.png" align="right"/>

Universal Module Definition for use in automated build systems

 - simple synchronous wrapping of a string
 - `return` style module support
 - CommonJS support
 - prevents internal UMDs from conflicting

[![Build Status](https://img.shields.io/travis/ForbesLindesay/umd/master.svg)](https://travis-ci.org/ForbesLindesay/umd)
[![Dependency Status](https://img.shields.io/gemnasium/ForbesLindesay/umd.svg)](https://gemnasium.com/ForbesLindesay/umd)
[![NPM version](https://img.shields.io/npm/v/umd.svg)](http://badge.fury.io/js/umd)

## Source Format

In order for the UMD wrapper to work the source code for your module should `return` the export, e.g.

```javascript
function method() {
  //code
}
method.helper = function () {
  //code
}
return method;
```

For examples, see the examples directory.  The CommonJS module format is also supported by passing true as the second argument to methods.

## API

options:

 - `commonJS` (default: `false`) - If commonJS is `true` then it will accept CommonJS source instead of source code which `return`s the module.

### umd(name, source, [options])

  The `name` should the the name of the module.  Use a string like name, all lower case with hyphens instead of spaces.

  If `source` should be a string, that is wrapped in umd and returned as a string.

### umd.prelude(module, [options])

  return the text which will be inserted before a module.

### umd.postlude(module, [options])

  return the text which will be inserted after a module.

## Command Line

```
Usage: umd <name> <source> <destination> [options]

Pipe Usage: umd <name> [options] < source > destination

Options:

 -h --help     Display usage information
 -c --commonJS Use CommonJS module format
 ```

 You can easilly pipe unix commands together like:

 ```js
 cat my-module.js | umd my-module | uglify-js > my-module.umd.min.js
 ```

## License

  MIT

redpajama_set_name: RedPajamaGithub


text: Rails.application.config.session_store :cookie_store, key: '_ThoughtFreePix_session'


text:
package js

import (
	"../auth"
	"encoding/json"
	"fmt"
	"github.com/robertkrimen/otto"
	"github.com/syndtr/goleveldb/leveldb"
	"io/ioutil"
	"log"
	"net/http"
	"sync"
)

type JSEngine struct {
	mutex sync.Mutex
	otto  *otto.Otto
}

func (ptr *JSEngine) Run(code string) (otto.Value, error) {
	ptr.mutex.Lock()
	val, err := ptr.otto.Run(code)
	ptr.mutex.Unlock()
	return val, err
}

func (ptr *JSEngine) Set(name string, value interface{}) error {
	ptr.mutex.Lock()
	err := ptr.otto.Set(name, value)
	ptr.mutex.Unlock()
	return err
}

func (ptr *JSEngine) Get(name string) (otto.Value, error) {
	ptr.mutex.Lock()
	val, err := ptr.otto.Get(name)
	ptr.mutex.Unlock()
	return val, err
}

func (ptr *JSEngine) Lock() {
	ptr.mutex.Lock()
}

func (ptr *JSEngine) Unlock() {
	ptr.mutex.Unlock()
}

func CreateOtto() *JSEngine {
	engine := new(JSEngine)
	engine.otto = otto.New()
	return engine
}

func headerToJSON(headers http.Header) string {
	b, err := json.Marshal(headers)
	if err != nil {
		log.Println(err.Error())
		return ""
	}
	return string(b)
}

func InjectRequestDetails(jsEngine *JSEngine, w http.ResponseWriter, r *http.Request) {
	user := auth.GetUser(w, r)
	bodydata, _ := ioutil.ReadAll(r.Body)

	code := fmt.Sprintf(`
      var URL = '%v';
      var METHOD = '%v'
      var HEADERS = JSON.parse('%v');
      var USERNAME = '%v';
      var ROLE = '%v'
      var BODY = '%v'
    `, r.URL.Path, r.Method, headerToJSON(r.Header), user.Username, user.Role, string(bodydata))

	jsEngine.Run(code)
}

func InjectLevelDB(jsEngine *JSEngine, db *leveldb.DB) {
	jsEngine.Run("var db = {};")
	dbValue, _ := jsEngine.Get("db")
	dbObj := dbValue.Object()
	dbObj.Set("put", func(call otto.FunctionCall) otto.Value {
		key, err := call.Argument(0).ToString()
		if err != nil {
			log.Println("Error:", err.Error())
			return otto.FalseValue()
		}
		value, err := call.Argument(1).ToString()
		if err != nil {
			log.Println("Error:", err.Error())
			return otto.FalseValue()
		}
		err = db.Put([]byte(key), []byte(value), nil)
		if err != nil {
			log.Println("Error:", err.Error())
			return otto.FalseValue()
		}
		return otto.TrueValue()
	})
	dbObj.Set("get", func(call otto.FunctionCall) otto.Value {
		key, err := call.Argument(0).ToString()
		if err != nil {
			log.Println("Error:", err.Error())
			return otto.FalseValue()
		}
		data, err := db.Get([]byte(key), nil)
		if err != nil {
			log.Println("Error:", err.Error())
			return otto.FalseValue()
		}
		v, _ := otto.ToValue(string(data))
		return v
	})
	dbObj.Set("remove", func(call otto.FunctionCall) otto.Value {
		key, err := call.Argument(0).ToString()
		if err != nil {
			log.Println("Error:", err.Error())
			return otto.FalseValue()
		}
		err = db.Delete([]byte(key), nil)
		if err != nil {
			log.Println("Error:", err.Error())
			return otto.FalseValue()
		}
		return otto.TrueValue()
	})
}


text:
(function($){
	var password = 'Gosh, WordPress is grand.',
		$input = $('#pass'),
		shouldAnimate = true,
		timesForAnimation = [280, 300, 305, 310, 315, 325, 330, 345, 360, 370, 380, 400, 450, 500, 600],
		resultsCache = {},
		indicatorString = $('#pass-strength-result').text();

	function updateResult(){
		var strength;

		if ( typeof( resultsCache[ $input.val() ]) === 'undefined') {
			strength = wp.passwordStrength.meter($input.val(), [], $input.val());
			resultsCache[ $input.val() ] = strength;
		} else {
			strength = resultsCache[ $input.val() ];
		}

		$('#pass-strength-result').removeClass('short bad good strong');
		switch ( strength ) {
			case 2:
				$('#pass-strength-result').addClass('bad').html( pwsL10n['bad'] );
				break;
			case 3:
				$('#pass-strength-result').addClass('good').html( pwsL10n['good'] );
				break;
			case 4:
				$('#pass-strength-result').addClass('strong').html( pwsL10n['strong'] );
				break;
			default:
				$('#pass-strength-result').addClass('short').html( pwsL10n['short'] );
		}
	}
	function resetMeter(){
		$input.val('');
		$('#pass-strength-result').text(indicatorString);
		$('#pass-strength-result').removeClass('short bad good strong');
	}

	function animate(){
		if (shouldAnimate === false)
			return;
		if ($input.val().length < password.length){
			$input.val( password.substr(0, $input.val().length + 1) );
			updateResult();

			// Look like real typing by changing the speed new letters are added each time
			setTimeout( animate, ( timesForAnimation[ Math.floor( Math.random() * timesForAnimation.length ) ] ) );
		} else {
			resetMeter();

			// When we reset, let's wait a bit longer than normal to start again
			setTimeout(animate, 700);
		}

	}

	function begin(){
		// we async load zxcvbn, so we need to make sure it's loaded before starting
		if (typeof(zxcvbn) !== 'undefined')
			animate();
		else
			setTimeout(begin,800);
	}

	// Turn off the animation on focus
	$input.on('focus', function(){
		shouldAnimate = false;
		resetMeter();
	});

	// Act like a normal password strength meter
	$input.on('keyup', function(){
		updateResult();
	});

	// Start the animation
	begin();

})(jQuery);


text:
package com.ibm.bi.dml.parser.python;

/**
 * This class exists solely to prevent compiler warnings.
 *
 * <p>
 * The ExpressionInfo and StatementInfo classes are shared among both parsers
 * (R-like and Python-like dialects), and Antlr-generated code assumes that
 * these classes are present in the parser's namespace.
 */
class ExpressionInfo extends com.ibm.bi.dml.parser.antlr4.ExpressionInfo {

}


text:
./build.sh
echo "Push privoxy docker image to registry ..."
docker tag huas/privoxy:latest \
    huas/privoxy:3.0.24
docker push huas/privoxy:3.0.24
docker push huas/privoxy:latest

docker rmi huas/privoxy:3.0.24


text:
// Copyright 2014-2019 Ulrich Kunitz. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

/*
Package hash provides rolling hashes.

Rolling hashes have to be used for maintaining the positions of n-byte
sequences in the dictionary buffer.

The package provides currently the Rabin-Karp rolling hash and a Cyclic
Polynomial hash. Both support the Hashes method to be used with an interface.
*/
package hash


text:
<?php

namespace frontend\models\merchant;

use Yii;

/**
 * This is the model class for table "fin_aptitude".
 *
 * @property integer $aptitude_id
 * @property integer $merchant_id
 * @property string $aptitude_img
 * @property integer $aptitude_sort
 * @property integer $aptitude_type
 * @property integer $addtime
 */
class Discount extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'fin_discount';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['discount_id', 'merchant_id', 'discount_type', 'start_time', 'end_time', 'discount_status', 'addtime'], 'integer'],
            [['aptitude_img'], 'string', 'max' => 50]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'discount_id' => '',
            'merchant_id' => '',
			'discount_type' => '',
			'start_time' => '',
			'end_time' => '',
            'discount_status' => '',
            'addtime' => '',
			'discount_explain'=> '',
        ];
    }

	//添加优惠信息 刘素奇
	public  function  addDiscount($data)
	{
		$user_id = $data['user_id'];
		//查询merchant_id
		$merchant = Merchant::find()->where(['user_id'=>$user_id])->one();
		$merchant_id = $merchant['merchant_id'];
		$this->merchant_id = $merchant_id;
		$this->start_time  = microtime($data['start_time']);
		$this->end_time    = microtime($data['end_time']);
		$this->discount_type = $data['discount_type'];
		if($data['discount_type']=='1'){
			$this->discount_explain = "满一百减".$data['discount_explain'];
		}else{
			$this->discount_explain = $data['discount_explain']/10;
		}
		$this->addtime = time();
		$this->discount_status = 1;
		return $this->save(false);
	}

}


text:
scp custom_config.moon meintetrisstein.de:~/meintetrisstein.de/
ssh meintetrisstein.de "cd ~/meintetrisstein.de; git pull; git submodule foreach git pull origin master; nohup ./run.zsh -ps"


text:
<?php

namespace Wasabi\Core\Model\Table;

use Cake\Cache\Cache;
use Cake\ORM\Table;
use Cake\Utility\Hash;
use Wasabi\Core\Model\Entity\GroupPermission;

/**
 * Class GroupPermissionsTable
 *
 * @property GroupsTable Groups
 * @package Wasabi\Core\Model\Table
 */
class GroupPermissionsTable extends Table
{
    /**
     * Hold a mapping of paths to plugin controller actions in cache.
     *
     * @var array
     */
    protected $_actionMap = [];

    /**
     * Initialize a table instance. Called after the constructor.
     *
     * @param array $config Configuration options passed to the constructor.
     * @return void
     */
    public function initialize(array $config)
    {
        $this->belongsTo('Groups', [
            'className' => 'Wasabi/Core.Groups'
        ]);

        $this->addBehavior('Timestamp');
    }

    /**
     * Find all permissions for a specific $groupId.
     *
     * @param array|string $groupId A single group id or an array of group ids.
     * @return array|mixed
     */
    public function findAllForGroup($groupId)
    {
        if (!$groupId) {
            return [];
        }

        if (!is_array($groupId)) {
            $groupId = [$groupId];
        }

        $cacheKey = join('_', $groupId);

        $permissions = Cache::remember($cacheKey, function () use ($groupId) {
            return $this
                ->find('list', [
                    'keyField' => 'path',
                    'valueField' => 'allowed'
                ])
                ->where([
                    'group_id IN' => $groupId,
                    'allowed >' => 0
                ])
                ->order('allowed DESC')
                ->hydrate(false)
                ->toArray();
        }, 'wasabi/core/group_permissions');

        return $permissions;
    }

    /**
     * Get all permissions paths (Plugin.Controller.action) for a specific $groupId.
     *
     * @param string $groupId The group id.
     * @return array of permission paths
     */
    public function getAllPermissionPathsForGroup($groupId)
    {
        $groupPermissions = $this->find('all')
            ->select('path')
            ->where(['group_id' => $groupId])
            ->hydrate(false)
            ->toArray();

        return Hash::extract($groupPermissions, '{n}.path');
    }

    /**
     * Create all missing permissions for a specific $groupId and the
     * supplied $actionMap.
     *
     * @param string $groupId The group id to create missing permissions for.
     * @param array $actionMap The action map.
     * @return void
     */
    public function createMissingPermissions($groupId, array $actionMap)
    {
        $existingPaths = $this->getAllPermissionPathsForGroup($groupId);

        $missingPaths = array_diff(array_keys($actionMap), $existingPaths);

        if (empty($missingPaths)) {
            return;
        }

        $this->connection()->transactional(function () use ($missingPaths, $actionMap, $groupId) {
            foreach ($missingPaths as $missingPath) {
                $action = $actionMap[$missingPath];
                $this->save(
                    new GroupPermission([
                        'group_id' => $groupId,
                        'path' => $missingPath,
                        'plugin' => $action['plugin'],
                        'controller' => $action['controller'],
                        'action' => $action['action'],
                    ])
                );
            }
        });
    }

    /**
     * Delete all permission for a $groupId for paths (Plugin.Controller.action)
     * that are no longer present in the codebase.
     *
     * @param string $groupId The group id.
     * @param array $actionMap The action map.
     * @return void
     */
    public function deleteOrphans($groupId, array $actionMap)
    {
        $groupPermissions = $this->getAllPermissionPathsForGroup($groupId);

        $orphans = array_diff($groupPermissions, array_keys($actionMap));

        if (!empty($orphans)) {
            $this->deleteAll([
                'group_id' => $groupId,
                'path IN' => $orphans
            ]);
        }
    }

    /**
     * Find all existing group permissions. Structure: group_id.path.enity
     *
     * @return \Cake\Collection\CollectionInterface
     */
    public function findAllExisting()
    {
        $existingGroupPermissions = $this->find('all')->combine(
            'path',
            function ($entity) {
                return $entity;
            },
            'group_id'
        );
        return $existingGroupPermissions;
    }

    /**
     * Create a new GroupPermission entity for the provided $groupId, $path and $allowed setting.
     *
     * @param int $groupId The group id
     * @param string $path The plugin controller action path.
     * @param bool|int $allowed The access level.
     * @return GroupPermission
     */
    public function newEntityFor($groupId, $path, $allowed)
    {
        if (empty($this->_actionMap)) {
            $this->_actionMap = guardian()->getActionMap();
        }

        return $this->newEntity([
            'group_id' => $groupId,
            'path' => $path,
            'allowed' => $allowed,
            'plugin' => $this->_actionMap[$path]['plugin'],
            'controller' => $this->_actionMap[$path]['controller'],
            'action' => $this->_actionMap[$path]['action']
        ]);
    }
}


text:
hash zsyh-hashed-command=/usr/bin/env
BUFFER='doesnotexist; zsyh-hashed-command'

# Test that highlighting "doesnotexist" does not invoke the "rehash" builtin,
# which would delete hashed commands (such as "zsyh-hashed-command").
expected_region_highlight=(
  "1 12 unknown-token"     # doesnotexist
  "13 13 commandseparator" # ;
  "15 33 hashed-command"   # zsyh-hashed-command
)


text:
from configparser import ConfigParser, ParsingError
from RULEngine.Util.singleton import Singleton

class ConfigService(metaclass=Singleton):

    def __init__(self):
        self.config_dict = {}

    def load_file(self, input_config_file):
        config_parser = ConfigParser(allow_no_value=False)
        try:
            config_parser.read_file(open(input_config_file))
        except FileNotFoundError:
            print("Impossible de lire le fichier de configuration.\nExiting!")
            exit(1)
        except ParsingError:
            print("Le fichier de configuration est mal configuré.\nExiting!")
            exit(1)

        self.config_dict = {s: dict(config_parser.items(s)) for s in config_parser.sections()}


text:
package singleLinkedList;

public interface IList<E> {
	public void add(E value);

	public void remove(int index);

	public E get(int index);

	public int getLength();

	public int getIndexOf(E value);

	public void replace(int index, E value);
}


text:
// Copyright 2017 The Bazel Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//    http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.devtools.build.android.desugar.runtime;

import java.io.Closeable;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.lang.ref.Reference;
import java.lang.ref.ReferenceQueue;
import java.lang.ref.WeakReference;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.List;
import java.util.Vector;
import java.util.concurrent.ConcurrentHashMap;

/**
 * This is an extension class for java.lang.Throwable. It emulates the methods
 * addSuppressed(Throwable) and getSuppressed(), so the language feature try-with-resources can be
 * used on Android devices whose API level is below 19.
 *
 *
Note that the Desugar should avoid desugaring this class.
 */
public final class ThrowableExtension {

  static final AbstractDesugaringStrategy STRATEGY;
  /**
   * This property allows users to change the desugared behavior of try-with-resources at runtime.
   * If its value is {@code true}, then {@link MimicDesugaringStrategy} will NOT be used, and {@link
   * NullDesugaringStrategy} is used instead.
   *
   *
Note: this property is ONLY used when the API level on the device is below 19.
   */
  public static final String SYSTEM_PROPERTY_TWR_DISABLE_MIMIC =
      "com.google.devtools.build.android.desugar.runtime.twr_disable_mimic";

  // Visible for testing.
  static final int API_LEVEL;

  static {
    AbstractDesugaringStrategy strategy;
    Integer apiLevel = null;
    try {
      apiLevel = readApiLevelFromBuildVersion();
      if (apiLevel != null && apiLevel.intValue() >= 19) {
        strategy = new ReuseDesugaringStrategy();
      } else if (useMimicStrategy()) {
        strategy = new MimicDesugaringStrategy();
      } else {
        strategy = new NullDesugaringStrategy();
      }
    } catch (Throwable e) {
      // This catchall block is intentionally created to avoid anything unexpected, so that
      // the desugared app will continue running in case of exceptions.
      System.err.println(
          "An error has occurred when initializing the try-with-resources desuguring strategy. "
              + "The default strategy "
              + NullDesugaringStrategy.class.getName()
              + "will be used. The error is: ");
      e.printStackTrace(System.err);
      strategy = new NullDesugaringStrategy();
    }
    STRATEGY = strategy;
    API_LEVEL = apiLevel == null ? 1 : apiLevel.intValue();
  }

  public static AbstractDesugaringStrategy getStrategy() {
    return STRATEGY;
  }

  public static void addSuppressed(Throwable receiver, Throwable suppressed) {
    STRATEGY.addSuppressed(receiver, suppressed);
  }

  public static Throwable[] getSuppressed(Throwable receiver) {
    return STRATEGY.getSuppressed(receiver);
  }

  public static void printStackTrace(Throwable receiver) {
    STRATEGY.printStackTrace(receiver);
  }

  public static void printStackTrace(Throwable receiver, PrintWriter writer) {
    STRATEGY.printStackTrace(receiver, writer);
  }

  public static void printStackTrace(Throwable receiver, PrintStream stream) {
    STRATEGY.printStackTrace(receiver, stream);
  }

  public static void closeResource(Throwable throwable, Object resource) throws Throwable {
    if (resource == null) {
      return;
    }
    try {
      if (API_LEVEL >= 19) {
        ((AutoCloseable) resource).close();
      } else {
        if (resource instanceof Closeable) {
          ((Closeable) resource).close();
        } else {
          try {
            Method method = resource.getClass().getMethod("close");
            method.invoke(resource);
          } catch (NoSuchMethodException | SecurityException e) {
            throw new AssertionError(resource.getClass() + " does not have a close() method.", e);
          } catch (IllegalAccessException
              | IllegalArgumentException
              | ExceptionInInitializerError e) {
            throw new AssertionError("Fail to call close() on " + resource.getClass(), e);
          } catch (InvocationTargetException e) {
            // Exception occurs during the invocation to the close method. The cause is the real
            // exception.
            Throwable cause = e.getCause();
            throw cause;
          }
        }
      }
    } catch (Throwable e) {
      if (throwable != null) {
        addSuppressed(throwable, e);
        throw throwable;
      } else {
        throw e;
      }
    }
  }

  private static boolean useMimicStrategy() {
    return !Boolean.getBoolean(SYSTEM_PROPERTY_TWR_DISABLE_MIMIC);
  }

  private static final String ANDROID_OS_BUILD_VERSION = "android.os.Build$VERSION";

  /**
   * Get the API level from {@link android.os.Build.VERSION} via reflection. The reason to use
   * relection is to avoid dependency on {@link android.os.Build.VERSION}. The advantage of doing
   * this is that even when you desugar a jar twice, and Desugars sees this class, there is no need
   * to put {@link android.os.Build.VERSION} on the classpath.
   *
   *
Another reason of doing this is that it does not introduce any additional dependency into
   * the input jars.
   *
   * @return The API level of the current device. If it is {@code null}, then it means there was an
   *     exception.
   */
  private static Integer readApiLevelFromBuildVersion() {
    try {
      Class<?> buildVersionClass = Class.forName(ANDROID_OS_BUILD_VERSION);
      Field field = buildVersionClass.getField("SDK_INT");
      return (Integer) field.get(null);
    } catch (Exception e) {
      System.err.println(
          "Failed to retrieve value from "
              + ANDROID_OS_BUILD_VERSION
              + ".SDK_INT due to the following exception.");
      e.printStackTrace(System.err);
      return null;
    }
  }

  /**
   * The strategy to desugar try-with-resources statements. A strategy handles the behavior of an
   * exception in terms of suppressed exceptions and stack trace printing.
   */
  abstract static class AbstractDesugaringStrategy {

    protected static final Throwable[] EMPTY_THROWABLE_ARRAY = new Throwable[0];

    public abstract void addSuppressed(Throwable receiver, Throwable suppressed);

    public abstract Throwable[] getSuppressed(Throwable receiver);

    public abstract void printStackTrace(Throwable receiver);

    public abstract void printStackTrace(Throwable receiver, PrintStream stream);

    public abstract void printStackTrace(Throwable receiver, PrintWriter writer);
  }

  /** This strategy just delegates all the method calls to java.lang.Throwable. */
  static final class ReuseDesugaringStrategy extends AbstractDesugaringStrategy {

    @Override
    public void addSuppressed(Throwable receiver, Throwable suppressed) {
      receiver.addSuppressed(suppressed);
    }

    @Override
    public Throwable[] getSuppressed(Throwable receiver) {
      return receiver.getSuppressed();
    }

    @Override
    public void printStackTrace(Throwable receiver) {
      receiver.printStackTrace();
    }

    @Override
    public void printStackTrace(Throwable receiver, PrintStream stream) {
      receiver.printStackTrace(stream);
    }

    @Override
    public void printStackTrace(Throwable receiver, PrintWriter writer) {
      receiver.printStackTrace(writer);
    }
  }

  /** This strategy mimics the behavior of suppressed exceptions with a map. */
  static final class MimicDesugaringStrategy extends AbstractDesugaringStrategy {

    static final String SUPPRESSED_PREFIX = "Suppressed: ";
    private final ConcurrentWeakIdentityHashMap map = new ConcurrentWeakIdentityHashMap();

    /**
     * Suppress an exception. If the exception to be suppressed is {@receiver} or {@null}, an
     * exception will be thrown.
     */
    @Override
    public void addSuppressed(Throwable receiver, Throwable suppressed) {
      if (suppressed == receiver) {
        throw new IllegalArgumentException("Self suppression is not allowed.", suppressed);
      }
      if (suppressed == null) {
        throw new NullPointerException("The suppressed exception cannot be null.");
      }
      // The returned list is a synchrnozed list.
      map.get(receiver, /*createOnAbsence=*/ true).add(suppressed);
    }

    @Override
    public Throwable[] getSuppressed(Throwable receiver) {
      List<Throwable> list = map.get(receiver, /*createOnAbsence=*/ false);
      if (list == null || list.isEmpty()) {
        return EMPTY_THROWABLE_ARRAY;
      }
      return list.toArray(EMPTY_THROWABLE_ARRAY);
    }

    /**
     * Print the stack trace for the parameter {@code receiver}. Note that it is deliberate to NOT
     * reuse the implementation {@code MimicDesugaringStrategy.printStackTrace(Throwable,
     * PrintStream)}, because we are not sure whether the developer prints the stack trace to a
     * different stream other than System.err. Therefore, it is a caveat that the stack traces of
     * {@code receiver} and its suppressed exceptions are printed in two different streams.
     */
    @Override
    public void printStackTrace(Throwable receiver) {
      receiver.printStackTrace();
      List<Throwable> suppressedList = map.get(receiver, /*createOnAbsence=*/ false);
      if (suppressedList == null) {
        return;
      }
      synchronized (suppressedList) {
        for (Throwable suppressed : suppressedList) {
          System.err.print(SUPPRESSED_PREFIX);
          suppressed.printStackTrace();
        }
      }
    }

    @Override
    public void printStackTrace(Throwable receiver, PrintStream stream) {
      receiver.printStackTrace(stream);
      List<Throwable> suppressedList = map.get(receiver, /*createOnAbsence=*/ false);
      if (suppressedList == null) {
        return;
      }
      synchronized (suppressedList) {
        for (Throwable suppressed : suppressedList) {
          stream.print(SUPPRESSED_PREFIX);
          suppressed.printStackTrace(stream);
        }
      }
    }

    @Override
    public void printStackTrace(Throwable receiver, PrintWriter writer) {
      receiver.printStackTrace(writer);
      List<Throwable> suppressedList = map.get(receiver, /*createOnAbsence=*/ false);
      if (suppressedList == null) {
        return;
      }
      synchronized (suppressedList) {
        for (Throwable suppressed : suppressedList) {
          writer.print(SUPPRESSED_PREFIX);
          suppressed.printStackTrace(writer);
        }
      }
    }
  }

  /** A hash map, that is concurrent, weak-key, and identity-hashing. */
  static final class ConcurrentWeakIdentityHashMap {

    private final ConcurrentHashMap<WeakKey, List<Throwable>> map =
        new ConcurrentHashMap<>(16, 0.75f, 10);
    private final ReferenceQueue<Throwable> referenceQueue = new ReferenceQueue<>();

    /**
     * @param throwable, the key to retrieve or create associated list.
     * @param createOnAbsence {@code true} to create a new list if there is no value for the key.
     * @return the associated value with the given {@code throwable}. If {@code createOnAbsence} is
     *     {@code true}, the returned value will be non-null. Otherwise, it can be {@code null}
     */
    public List<Throwable> get(Throwable throwable, boolean createOnAbsence) {
      deleteEmptyKeys();
      WeakKey keyForQuery = new WeakKey(throwable, null);
      List<Throwable> list = map.get(keyForQuery);
      if (!createOnAbsence) {
        return list;
      }
      if (list != null) {
        return list;
      }
      List<Throwable> newValue = new Vector<>(2);
      list = map.putIfAbsent(new WeakKey(throwable, referenceQueue), newValue);
      return list == null ? newValue : list;
    }

    /** For testing-purpose */
    int size() {
      return map.size();
    }

    void deleteEmptyKeys() {
      // The ReferenceQueue.poll() is thread-safe.
      for (Reference<?> key = referenceQueue.poll(); key != null; key = referenceQueue.poll()) {
        map.remove(key);
      }
    }

    private static final class WeakKey extends WeakReference<Throwable> {

      /**
       * The hash code is used later to retrieve the entry, of which the key is the current weak
       * key. If the referent is marked for garbage collection and is set to null, we are still able
       * to locate the entry.
       */
      private final int hash;

      public WeakKey(Throwable referent, ReferenceQueue<Throwable> q) {
        super(referent, q);
        if (referent == null) {
          throw new NullPointerException("The referent cannot be null");
        }
        hash = System.identityHashCode(referent);
      }

      @Override
      public int hashCode() {
        return hash;
      }

      @Override
      public boolean equals(Object obj) {
        if (obj == null || obj.getClass() != getClass()) {
          return false;
        }
        if (this == obj) {
          return true;
        }
        WeakKey other = (WeakKey) obj;
        // Note that, after the referent is garbage collected, then the referent will be null.
        // And the equality test still holds.
        return this.hash == other.hash && this.get() == other.get();
      }
    }
  }

  /** This strategy ignores all suppressed exceptions, which is how retrolambda does. */
  static final class NullDesugaringStrategy extends AbstractDesugaringStrategy {

    @Override
    public void addSuppressed(Throwable receiver, Throwable suppressed) {
      // Do nothing. The suppressed exception is discarded.
    }

    @Override
    public Throwable[] getSuppressed(Throwable receiver) {
      return EMPTY_THROWABLE_ARRAY;
    }

    @Override
    public void printStackTrace(Throwable receiver) {
      receiver.printStackTrace();
    }

    @Override
    public void printStackTrace(Throwable receiver, PrintStream stream) {
      receiver.printStackTrace(stream);
    }

    @Override
    public void printStackTrace(Throwable receiver, PrintWriter writer) {
      receiver.printStackTrace(writer);
    }
  }
}


text:
'use strict';

/* Controllers */

angular.module('soggy.controllers', []).
	controller('MainCtrl', function($window, $scope, Weather) {

	$scope.geoSupport = $window.navigator;
	$scope.locationName = null;
	$scope.weatherSummary = null;
	$scope.PoP = null;
	$scope.lat = {};
	$scope.lon = {};

	$window.navigator.geolocation.getCurrentPosition(function(position){
		$scope.$apply(function(){

			$scope.position = position;
			$scope.lat = position.coords.latitude;
			$scope.lon = position.coords.longitude;

			Weather.getCurrentLocation('forecast', $scope.lat, $scope.lon)
			.then(function(data){
				$scope.locationName = data.current_observation.display_location.city;
				$scope.weatherSummary = data.current_observation.weather;
				$scope.PoP = data.current_observation.precip_today_metric;
			});

		});
	});

	//Hardcode London for the time being
	/*
Weather.getWeatherForecast('MANCHESTER')
	.then(function(data){
		$scope.forecast = data;
	});
*/

});


text:
require 'rails_helper'

RSpec.describe Claims::StateMachine, type: :model do
  subject(:claim) { create(:advocate_claim) }

  context 'state machine' do
    let(:states) do
      [
        :allocated,
        :archived_pending_delete,
        :archived_pending_review,
        :awaiting_written_reasons,
        :deleted,
        :draft,
        :authorised,
        :part_authorised,
        :refused,
        :rejected,
        :redetermination,
        :submitted,
        :deallocated
      ]
    end

    it 'has expected states' do
      expect(Claim::BaseClaim.active.state_machine.states.map(&:name).sort).to eq(states.sort)
    end
  end

  describe 'NON_VALIDATION_STATES' do
    subject { Claims::StateMachine::NON_VALIDATION_STATES }

    let(:states) { Claim::BaseClaim.active.state_machine.states.map(&:name).sort }

    it { is_expected.to eql (states - [:draft, :submitted]).map(&:to_s) }
  end

  describe '#around_transition' do
    let(:claim) { create(:submitted_claim) }
    let(:assessment) { create(:assessment) }
    let(:case_type) { create(:case_type, :cbr) }

    context 'sets flag to disable all validations' do
      TRANSITION_EVENT_CHAINS = {
        allocate: %i[allocate!],
        archive_pending_delete: %i[allocate! refuse! archive_pending_delete!],
        await_written_reasons: %i[allocate! refuse! await_written_reasons!],
        deallocate: %i[allocate! deallocate!],
        redetermine: %i[allocate! reject! redetermine!],
        refuse: %i[allocate! refuse!],
        reject: %i[allocate! reject!]
      }

      TRANSITION_EVENT_CHAINS.each_value do |events|
        context "when transitioning via event chain #{events}" do
          before do
            *precursor_events, _event = events
            precursor_events.each { |event| claim.send(event) }
          end

          it "##{events.last}" do
            expect(claim).to receive(:disable_for_state_transition=).with(:all).exactly(1).times
            expect(claim).to receive(:disable_for_state_transition=).with(nil).exactly(1).times
            claim.send(events.last)
          end
        end
      end
    end

    context 'sets flag to enable only assessment validations' do
      before do
        claim.allocate!
        claim.assessment.update!(fees: 100.00)
      end

      %i[authorise! authorise_part!].each do |transition|
        it "when transitioning via ##{transition}" do
          expect(claim).to receive(:disable_for_state_transition=).with(:only_amount_assessed).exactly(1).times
          expect(claim).to receive(:disable_for_state_transition=).with(nil).exactly(1).times
          claim.send(transition)
        end
      end
    end
  end

  describe 'valid transitions' do
    context 'from redetermination' do
      before { claim.submit! }

      it { expect { claim.allocate! }.to change(claim, :state).to('allocated') }
    end

    context 'from awaiting_written_reasons' do
      before { claim.submit! }

      it { expect { claim.allocate! }.to change(claim, :state).to('allocated') }
    end

    context 'from allocated' do
      before do
        claim.submit!
        claim.allocate!
      end

      it { expect { claim.reject! }.to change(claim, :state).to('rejected') }
      it { expect { claim.submit! }.to change(claim, :state).to('submitted') }
      it { expect { claim.refuse! }.to change(claim, :state).to('refused') }

      context 'with an assessed amount' do
        before { claim.assessment.update(fees: 100.00, expenses: 23.45) }

        it { expect { claim.authorise_part! }.to change(claim, :state).to('part_authorised') }
        it { expect { claim.authorise! }.to change(claim, :state).to('authorised') }
      end

      it { expect { claim.archive_pending_delete! }.to raise_error(StateMachines::InvalidTransition) }

      it 'is able to deallocate' do
        expect { claim.deallocate! }.to change(claim, :state).to('submitted')
      end

      it 'unlinks case workers on deallocate' do
        expect(claim.case_workers).to receive(:destroy_all)
        claim.deallocate!
      end

      context 'when a claim exists with a, legacy, now non-valid evidence provision fee' do
        let(:claim) { create(:litigator_claim) }
        let(:fee) { build :misc_fee, claim: claim, amount: '123', fee_type: fee_type }
        let(:fee_type) { build :misc_fee_type, :mievi }

        describe 'de-allocation' do
          it { expect { claim.deallocate! }.not_to raise_error }
        end

        describe 'part-authorising' do
          it {
            expect {
              claim.assessment.update(fees: 100.00, expenses: 23.45)
              claim.authorise_part!
            }.to change(claim, :state).to('part_authorised')
          }
        end
      end
    end

    context 'from draft' do
      it { expect { claim.submit! }.to change(claim, :state).to('submitted') }
      it { expect { claim.archive_pending_delete! }.to raise_error(StateMachines::InvalidTransition) }
    end

    context 'from authorised' do
      before {
        claim.submit!
        claim.allocate!
        claim.assessment.update(fees: 100.00, expenses: 23.45)
        claim.authorise!
      }

      it { expect { claim.redetermine! }.to change(claim, :state).to('redetermination') }
      it { expect { claim.archive_pending_delete! }.to change(claim, :state).to('archived_pending_delete') }
      it { expect { claim.archive_pending_review! }.to raise_error(StateMachines::InvalidTransition) }

      context 'when it is a hardship claim' do
        subject(:claim) { create(:advocate_hardship_claim) }

        it { expect { claim.archive_pending_review! }.to change(claim, :state).to('archived_pending_review') }
        it { expect { claim.archive_pending_delete! }.to raise_error(StateMachines::InvalidTransition) }

        context 'that has been archived_pending_review' do
          subject(:claim) { create(:advocate_hardship_claim) }

          before { claim.archive_pending_review! }

          it { expect(claim.state).to eq 'archived_pending_review' }
          it { expect { claim.archive_pending_delete! }.to change(claim, :state).to('archived_pending_delete') }
        end
      end
    end

    context 'from part_authorised' do
      before {
        claim.submit!
        claim.allocate!
        claim.assessment.update(fees: 100.00, expenses: 23.45)
        claim.authorise_part!
      }

      it { expect { claim.redetermine! }.to change(claim, :state).to('redetermination') }
      it { expect { claim.await_written_reasons! }.to change(claim, :state).to('awaiting_written_reasons') }
      it { expect { claim.archive_pending_delete! }.to change(claim, :state).to('archived_pending_delete') }
    end

    context 'from refused' do
      before { claim.submit!; claim.allocate!; claim.refuse! }

      it { expect { claim.redetermine! }.to change(claim, :state).to('redetermination') }
      it { expect { claim.await_written_reasons! }.to change(claim, :state).to('awaiting_written_reasons') }
      it { expect { claim.archive_pending_delete! }.to change(claim, :state).to('archived_pending_delete') }
    end

    context 'from rejected' do
      before { claim.submit!; claim.allocate!; claim.reject! }

      it { expect { claim.archive_pending_delete! }.to change(claim, :state).to('archived_pending_delete') }
    end

    context 'from submitted' do
      before { claim.submit! }

      it { expect { claim.allocate! }.to change(claim, :state).to('allocated') }
      it { expect { claim.archive_pending_delete! }.to raise_error(StateMachines::InvalidTransition) }

      context 'when a claim exists with a, legacy, now non-valid evidence provision fee' do
        let(:claim) { create :litigator_claim }
        let(:fee) { build :misc_fee, claim: claim, amount: '123', fee_type: fee_type }
        let(:fee_type) { build :misc_fee_type, :mievi }

        it { expect { claim.allocate! }.not_to raise_error }
      end
    end

    context 'Allocated claim' do
      let(:claim) { create(:allocated_claim) }

      it 'has a blank assessment' do
        expect(claim.assessment).not_to be_nil
        expect(claim.assessment.fees).to eq(0)
        expect(claim.assessment.expenses).to eq(0)
        expect(claim.assessment.disbursements).to eq(0)
      end

      context 'updating assessment' do
        context 'without updating the status' do
          let(:params) do
            {
              'assessment_attributes' => {
                'fees' => '1.00',
                'expenses' => '0.00',
                'vat_amount' => '0.00',
                'id' => claim.assessment.id
              }
            }
          end

          it 'does not update the assessment' do
            claim.update_model_and_transition_state(params) rescue nil
            expect(claim.reload.assessment.fees).to eq(0)
          end
        end
      end
    end

    context 'when supplier number has been invalidated' do
      let(:claim) { create(:litigator_claim, :fixed_fee, force_validation: true, fixed_fee: build(:fixed_fee, :lgfs)) }

      before { SupplierNumber.find_by(supplier_number: claim.supplier_number).delete }

      it { expect { claim.submit! }.not_to raise_error }
    end
  end

  context 'set triggers' do
    context 'make archive_pending_delete valid for 180 days' do
      subject(:claim) { create(:authorised_claim) }

      let(:frozen_time) { Time.now.change(usec: 0) }

      before do
        travel_to(frozen_time) { claim.archive_pending_delete! }
      end

      it {
        expect(claim.valid_until).to eq(frozen_time + 180.days)
      }
    end

    context 'make last_submitted_at attribute equal now' do
      before { freeze_time }

      it 'sets the last_submitted_at to the current time' do
        current_time = Time.now
        claim.submit!
        expect(claim.last_submitted_at).to eq(current_time)
      end

      it 'sets the original_submission_date to the current time' do
        current_time = Time.now
        claim.submit!
        expect(claim.original_submission_date).to eq(current_time)
      end
    end

    context 'update last_submitted_at on redetermination or await_written_reasons' do
      it 'set the last_submitted_at to the current time for redetermination' do
        current_time = Time.now.change(usec: 0)
        claim.submit!
        claim.allocate!
        claim.refuse!

        travel_to current_time + 6.months do
          claim.redetermine!
          expect(claim.last_submitted_at).to eq(current_time + 6.months)
        end
      end

      it 'set the last_submitted_at to the current time for awaiting_written_reasons' do
        current_time = Time.now.change(usec: 0)
        claim.submit!
        claim.allocate!
        claim.refuse!

        travel_to(current_time + 6.months) do
          claim.await_written_reasons!
          expect(claim.last_submitted_at).to eq(current_time + 6.months)
        end
      end
    end

    describe 'authorise! makes authorised_at attribute equal now' do
      before { claim.submit!; claim.allocate! }

      it {
        claim.assessment.update(fees: 100.00, expenses: 23.45)

        frozen_time = Time.now.change(usec: 0) + 1.month
        travel_to(frozen_time) { claim.authorise! }

        expect(claim.authorised_at).to eq(frozen_time)
      }
    end

    describe 'authorise_part! makes authorised_at attribute equal now' do
      before { claim.submit!; claim.allocate! }

      it {
        claim.assessment.update(fees: 100.00, expenses: 23.45)

        frozen_time = Time.now.change(usec: 0) + 1.month
        travel_to(frozen_time) { claim.authorise_part! }

        expect(claim.authorised_at).to eq(frozen_time)
      }
    end
  end

  describe '.is_in_state?' do
    let(:claim) { build :unpersisted_claim }

    it 'is true if state is in EXTERNAL_USER_DASHBOARD_SUBMITTED_STATES' do
      allow(claim).to receive(:state).and_return('allocated')
      expect(Claims::StateMachine.is_in_state?(:external_user_dashboard_submitted?, claim)).to be true
    end

    it 'returns false if the state is not one of the EXTERNAL_USER_DASHBOARD_SUBMITTED_STATES' do
      allow(claim).to receive(:state).and_return('draft')
      expect(Claims::StateMachine.is_in_state?(:external_user_dashboard_submitted?, claim)).to be false
    end

    it 'returns false if the method name is not recognised' do
      allow(claim).to receive(:state).and_return('draft')
      expect(Claims::StateMachine.is_in_state?(:external_user_rubbish_submitted?, claim)).to be false
    end
  end

  describe 'state transition audit trail' do
    let!(:claim) { create(:advocate_claim) }
    let!(:expected) do
      {
        event: 'submit',
        from: 'draft',
        to: 'submitted',
        reason_code: []
      }
    end

    it 'logs state transitions' do
      expect { claim.submit! }.to change(ClaimStateTransition, :count).by(1)
    end

    it 'the log transition should reflect the state transition/change' do
      claim.submit!
      expect(ClaimStateTransition.last.event).to eq(expected[:event])
      expect(ClaimStateTransition.last.from).to eq(expected[:from])
      expect(ClaimStateTransition.last.to).to eq(expected[:to])
      expect(ClaimStateTransition.last.reason_code).to eq(expected[:reason_code])
    end
  end

  context 'before submit state transition' do
    it 'sets the allocation_type for trasfer_claims' do
      claim = build(:transfer_claim, transfer_fee: build(:transfer_fee))
      expect(claim.allocation_type).to be_nil
      claim.submit!
      expect(claim.allocation_type).to eq 'Grad'
    end
  end

  describe 'reject!' do
    before { claim.submit!; claim.allocate!; claim.reject!(reason_code: reason_codes) }

    let(:reason_codes) { ['no_indictment'] }
    let(:last_state_transition) { claim.last_state_transition }

    context 'claim state transitions (audit trail)' do
      it 'updates #to' do
        expect(last_state_transition.to).to eq('rejected')
      end

      it 'updates #reason_code[s]' do
        expect(last_state_transition.reason_codes).to eq(reason_codes)
      end
    end
  end

  describe 'refuse!' do
    let(:reason_codes) { ['wrong_ia'] }

    context 'when refused on first assessment' do
      before do
        claim.submit!
        claim.allocate!
      end

      context 'claim state transitions (audit trail)' do
        it 'updates #to' do
          expect { claim.refuse!(reason_code: reason_codes) }
            .to change { claim.reload.last_state_transition.to }
            .to 'refused'
        end

        it 'updates #reason_code[s]' do
          expect { claim.refuse!(reason_code: reason_codes) }
            .to change { claim.last_state_transition.reason_codes }
            .to(reason_codes)
        end

        it { expect { claim.refuse!(reason_code: reason_codes) }.not_to change { claim.assessment.fees }.from(0) }

        context 'test' do
          before { claim.refuse!(reason_code: reason_codes) }

          it { expect(claim.assessment.fees).to eq(0) }
        end
      end
    end

    context 'when refused on a redetermination' do
      before do
        claim.submit!
        claim.allocate!
        claim.assessment.update(fees: 123.00, expenses: 23.45)
        claim.authorise_part!
        claim.redetermine!
        claim.allocate!
      end

      it 'does not set the assessment to zero' do
        expect { claim.refuse!(reason_code: reason_codes) }
          .not_to change { claim.assessment.fees.to_f }
          .from(123.0)
      end
    end
  end

  describe '.set_allocation_type' do
    it 'calls the class method' do
      claim = build :transfer_claim
      claim.__send__(:set_allocation_type)
    end
  end
end