Package com.wesabe.api.accounts.presenters.tests

Source Code of com.wesabe.api.accounts.presenters.tests.AccountReferencePresenterTest$Presenting_An_Account_Reference

package com.wesabe.api.accounts.presenters.tests;

import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;

import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.runners.Enclosed;
import org.junit.runner.RunWith;

import com.wesabe.api.accounts.entities.Account;
import com.wesabe.api.accounts.presenters.AccountReferencePresenter;
import com.wesabe.xmlson.XmlsonObject;

@RunWith(Enclosed.class)
public class AccountReferencePresenterTest {
  public static class Presenting_An_Account_Reference {
    private Account account;
    private AccountReferencePresenter presenter;
   
    @Before
    public void setup() throws Exception {
      this.account = mock(Account.class);
      when(account.getRelativeId()).thenReturn(4);
     
      this.presenter = new AccountReferencePresenter();
    }
   
    @Test
    public void itIsNamedAccount() throws Exception {
      final XmlsonObject representation = presenter.present(account);
     
      assertThat(representation.getName(), is("account"));
    }
   
    @Test
    public void itHasTheAccountsUri() throws Exception {
      final XmlsonObject representation = presenter.present(account);
     
      assertThat(representation.getString("uri"), is("/accounts/4"));
    }
  }
}
TOP

Related Classes of com.wesabe.api.accounts.presenters.tests.AccountReferencePresenterTest$Presenting_An_Account_Reference

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.