    @Test
    public void TestAdapter()
    {

        ActivityController activityController = Robolectric.buildActivity(BudgetActivity.class).create();
        Activity activity = (Activity)activityController.get();

        DBHelper db = new DBHelper(activity);
        final String NAME = "name";
        final int BUDGET = 100;
        final double CURRENT = 50.01;
        final int CURRENT_CEIL = (int)Math.ceil(CURRENT);

        db.insertBudget(NAME, BUDGET);
        db.insertTransaction(DBHelper.TransactionDbIds.EXPENSE, "", "", NAME, CURRENT, "", nowMs, "");
        db.close();

        final int SCALED_BUDGET = BUDGET * (MONTHS_PER_YEAR+1);

        final List<Budget> budgets = db.getBudgets(lastYearMs, nowMs);
        final BudgetAdapter adapter = new BudgetAdapter(activity, budgets);

        View view = adapter.getView(0, null, null);

        final TextView budgetName = (TextView) view.findViewById(R.id.budgetName);
        final ProgressBar budgetBar = (ProgressBar) view.findViewById(R.id.budgetBar);
        final TextView budgetValue = (TextView) view.findViewById(R.id.budgetValue);

        assertEquals(NAME, budgetName.getText().toString());
        assertEquals(CURRENT_CEIL, budgetBar.getProgress());
        assertEquals(SCALED_BUDGET, budgetBar.getMax());

        String fractionFormat = activity.getResources().getString(R.string.fraction);
        String fraction = String.format(fractionFormat, CURRENT_CEIL, SCALED_BUDGET);
        assertEquals(fraction, budgetValue.getText().toString());
    }