NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

package eecs2030.pe2;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import java.util.List;

import org.junit.Test;

import eecs2030.pe2.Call;
import eecs2030.pe2.CallZone;
import eecs2030.pe2.SmartAmericas10Card;

public class SmartAmericas10CardTesterBasic {


final double tol = 0.0001;

@Test
public void testConstructor() {
SmartAmericas10Card c1 = new SmartAmericas10Card(1,111);
assertTrue("argumented constructor sets balance wrong", Math.abs(c1.getBalance() - 10.0) < tol);
}

@Test
public void testCopyConstructor() {
SmartAmericas10Card c1 = new SmartAmericas10Card(1,111);
SmartAmericas10Card c2 = new SmartAmericas10Card(c1);
assertTrue("copy constructor fails (assuming equals works)", c1.equals(c2));
}

@Test
public void testAllowedZones(){
SmartAmericas10Card c1 = new SmartAmericas10Card(1,111);
assertTrue("allowedZones returns the wrong value",
c1.allowedZones().size() == 3);
}

@Test
public void testIsAllowed(){
SmartAmericas10Card c1 = new SmartAmericas10Card(1,111);
assertTrue("isAllowed returned the wrong value", c1.isAllowed(CallZone.CANADA));
}

@Test
public void testGetCallHistory1() {
SmartAmericas10Card c1 = new SmartAmericas10Card(1,111);
assertTrue("getCallHistory returned the wrong value for new card", c1.getCallHistory().size() == 0);
}

@Test
public void testGetCallHistory2() {
SmartAmericas10Card c1 = new SmartAmericas10Card(1,111);
Call call1 = new Call("+14167362100",CallZone.CANADA,2);
c1.charge(call1);
assertTrue("getCallHistory returned a list of the wrong size after one call",
c1.getCallHistory().size() == 1);
}

@Test
public void testCostPerMinutes(){
SmartAmericas10Card c1 = new SmartAmericas10Card(1,111);
assertTrue("costPerMin returned the wrong value for Canada",
Math.abs(c1.costPerMin(CallZone.CANADA) - 0.03) < tol);
}

@Test
public void testDeductWeeklyFee() {
SmartAmericas10Card c1 = new SmartAmericas10Card(1, 111);
double c1Bal = c1.getBalance();
c1.deductWeeklyFee();
assertTrue("deductWeeklyFee does not update balance correctly",
Math.abs(c1Bal - (c1.getBalance() + 0.3)) < tol);
}

@Test
public void testCharge1(){
SmartAmericas10Card c1 = new SmartAmericas10Card(1,111);
Call call1 = new Call("+14167362100",CallZone.CANADA,2);
assertTrue("charge returned the wrong value", c1.charge(call1));
}

@Test
public void testCharge2(){
SmartAmericas10Card c1 = new SmartAmericas10Card(1,111);
Call call1 = new Call("+14167362100",CallZone.CANADA,2);
c1.charge(call1);
assertTrue("charge did not update balance correctly after 2min call to Canada on new card",
Math.abs(SmartAmericas10Card.INITIAL_BALANCE - (c1.getBalance() + 2 * 0.03)) < tol);
}

@Test
public void testEquals(){
SmartAmericas10Card c1 = new SmartAmericas10Card(1,111);
SmartAmericas10Card c2 = new SmartAmericas10Card(1,111);
assertTrue("equals returned the wrong value for new identical cards", c1.equals(c2));
}

}
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.