Package br.com.mutley

Source Code of br.com.mutley.MutleyTest

package br.com.mutley;

import org.junit.Assert;
import org.junit.Test;

import br.com.mutley.data.Badge;
import br.com.mutley.data.Coder;

public class MutleyTest extends Assert {

  @Test
  public void itShouldGetTheCoder() throws Exception {
    Coder coder = CoderWall.getCoder("csrcordeiro");

    assertNotNull("Well...it should get the coder...", coder);
    assertEquals("César Cordeiro", coder.getName());
    assertEquals("São Paulo", coder.getLocation());
    assertNotNull(coder.getEndorsements());
    assertNull(coder.getTeam());
    assertTrue(coder.hasGithubAccount());
    assertTrue(coder.hasBadges());
    assertCharityBadge(coder.getBadge("Charity"));
  }

  private void assertCharityBadge(Badge charityBadge) {
    assertEquals("Charity", charityBadge.getName());
    assertEquals(
        "Fork and commit to someone's open source project in need",
        charityBadge.getDescription());
    assertEquals("2013-03-29T13:20:43Z", charityBadge.getCreated());
    assertNotNull(charityBadge.getBadge());
  }

  @Test
  public void testInvalidUser() {
    try {
      CoderWall.getCoder("jjdijdijdijdijd");
      fail("Should give me an exception.");
    } catch (Exception e) {
      assertEquals("User does not exists", e.getMessage());
    }
  }

}
TOP

Related Classes of br.com.mutley.MutleyTest

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.