9 Pages

10-JUnit

Course: CSE CSE-106, Spring 2009
School: A.T. Still University
Rating:
 
 
 
 
 

Word Count: 2135

Document Preview

JUnit Using in Eclipse 1, 2 by Christopher Batty Department of Computer Science, University of Manitoba, Winnipeg, Manitoba, Canada Last revised: October 30, 2003 Overview: In this document, we describe how to use Eclipse's built-in JUnit tools to create unit tests for Java classes. Unit Testing Basics When developing software we need to run our code to verify that it actually works as intended. As the software...

Register Now

Unformatted Document Excerpt

Coursehero >> Missouri >> A.T. Still University >> CSE CSE-106

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
JUnit Using in Eclipse 1, 2 by Christopher Batty Department of Computer Science, University of Manitoba, Winnipeg, Manitoba, Canada Last revised: October 30, 2003 Overview: In this document, we describe how to use Eclipse's built-in JUnit tools to create unit tests for Java classes. Unit Testing Basics When developing software we need to run our code to verify that it actually works as intended. As the software gets larger and larger, it becomes more likely that introducing a new change will "break" the existing code. At the same time, verifying all of a program's features by hand is a menial and time-consuming task. To reduce the need for manual testing, we can introduce unit tests which are small snippets of code designed to thoroughly exercise a particular function or class. With unit tests in place, when a change is made to the code we can simply run all the tests to ensure that nothing has been broken. An additional motivation for unit testing is to support test-driven development. Testdriven development involves writing unit tests first, with the actual code coming after. The reasoning is that in order to write complete, valid tests, you must have a solid understanding of how the new class should work, and in particular what its interface will be. Thus, the unit tests provide an executable definition of the class. When you move on to writing the actual code, you just have to fill in implementation, and once the tests are passed, the implementation is complete. In Java, the standard unit testing framework is known as JUnit. It was created by Erich Gamma and Kent Beck, two authors best known for design patterns and eXtreme Programming, respectively. Eclipse builds come with both JUnit and a plug-in for 1 2 This work was funded by an IBM Eclipse Innovation Grant. Christopher Batty and David Scuse Department of Computer Science University of Manitoba Tutorial 10 Page 1 Using JUnit in Eclipse www.cs.umanitoba.ca/~eclipse creating and working with JUnit tests. As a demonstration, we will use these tools to test a simple class for representing fractions. Creating a Test Case Using Eclipse, import the sample project (JUnitDemo) provided with this tutorial. (A second project, JUnitDemoWithTests, that contains the result of adding JUnit tests is also included.) It contains just SimpleFraction.java, which has functionality for creating, modifying and simplifying a Fraction. The first thing we must do is import junit.jar, so we have access to the testing framework. Right-click on the project name, and choose Properties. In the tree on the left, select Java Build Path. Next, choose Add External JARs... and browse to find junit.jar. It will be located in <eclipsedir>\plugins\org.junit_<version number>\junit.jar. Once you successfully import junit.jar, close the Properties page. Now we can create a test for our SimpleFraction class. Right-click the package you wish to place the test in, and choose New..., then select Other... In the tree on the left, expand the Java branch, and choose JUnit. Then in the list on the right select TestCase. This allows us to create a new test case for SimpleFraction. A Wizard will appear for creating a JUnit TestCase. Click on the Browse... button beside Test Class to select the class for testing. In our case it will be the SimpleFraction class, so type in SimpleFraction and select it from the list. Notice that the Test case name is automatically filled in as SimpleFractionTest. Appending "Test" to the name of the class being tested is the default test case naming scheme in JUnit. Department of Computer Science University of Manitoba Tutorial 10 Page 2 Using JUnit in Eclipse www.cs.umanitoba.ca/~eclipse The check-boxes at the bottom allow you to add stubs for additional useful methods. The first is a standard main() function which can be used to run this test individually as an application, rather than as a part of a large suite of tests. The drop-down menu gives you the choice of running with text output, an AWT-based GUI, or a more elaborate Swingbased GUI. This is unnecessary for us since we will be using Eclipse's built-in JUnit tools. The other stubs are for setUp() and tearDown() functions, which are called before and after each test case. They can be used to reduce redundant code if the tests require the same resources or data. For demonstration purposes, we will use a setUp() method to initialize a fraction used by multiple tests. Check setUp() and choose Next. The next screen allows you to select which of SimpleFraction's methods you want test stubs generated for. For now we will just test simplify() and getDenominator(), so we check these two boxes and hit Finish. Department of Computer Science University of Manitoba Tutorial 10 Page 3 Using JUnit in Eclipse www.cs.umanitoba.ca/~eclipse The class is created with the appropriate method stubs generated for us. All we need to do now is write the tests. Writing the Tests Since getDenominator() is straightforward, we will write testGetDenominator() first. We will create a couple of SimpleFractions and call getDenominator on each. Create two private SimpleFraction member variables like the following: private SimpleFraction f1, f2; In the setup method, add two lines to construct the fractions. f1 = new SimpleFraction(15, 25); f2 = new SimpleFraction(-27, 6); Each time a test method is called, the setUp() will run these two lines first, so at the start of each test the fractions will always be 15/25 and -27/6. Now to implement our testGetDenominator() method, add the following code to the method body. int result = f1.getDenominator(); assertTrue("getDenominator() returned " + result + " instead of 25.", result == 25); result = f2.getDenominator(); assertEquals(6, result); Since SimpleFractionTest is a subclass of the junit.framework.TestCase, it inherits a variety of methods for testing assertions (i.e. conditions that should be true) about the state of variables in the test. These include assertEquals, assertTrue/False, Department of Computer Science University of Manitoba Using JUnit in Eclipse www.cs.umanitoba.ca/~eclipse Tutorial 10 Page 4 assertSame/NotSame, and assertNull/NotNull. There is also a fail() method that just causes the current TestCase to fail. These methods generally come in two flavours: a plain version, and a version with a String parameter to provide details about the assertion that In failed. the code above, you can see examples of each. Whenever the assertion in one of the methods fails, the execution of that test method is terminated, and JUnit will record that test as having failed. Next we will implement testSimplify(). f1.simplify(); assertEquals(3, f1.getNumerator()); assertEquals(5, f1.getDenominator()); This will verify that our simplify() method correctly reduces 15/25 to 3/5. Running the Tests Now that the tests have been written, we would like to run them. The process for running JUnit tests is very similar to that for running regular Java Applications. From the Run menu choose Run... Select JUnit in the tree on the left, and hit New. The screen should look like the following, assuming SimpleFractionTest was selected when you opened the Run menu. (If not, simply browse to find SimpleFractionTest.) Next, just choose Run, and the TestCase will be executed. If it ran successfully, you will see a message in the status bar at the bottom of the screen that looks like the following. If the JUnit view is visible, it will display a green bar, indicating a successful test. We will look at the JUnit view in more detail later on. Department of Computer Science University of Manitoba Tutorial 10 Page 5 Using JUnit in Eclipse www.cs.umanitoba.ca/~eclipse Debugging a Failed Test Now, let's add another piece of code to our testSimplify() method. f2.simplify(); assertEquals(-9, f2.getNumerator()); assertEquals(2, f2.getDenominator()); This looks very similar to the previous code in testSimpify(). However, consider what happens when we run the tests again. The JUnit view will be displayed on the left of the screen (if it is not already visible) and it will show a red bar indicating that one or more tests failed. The top part of the view displays the names of the test method(s) that failed. By doubleclicking on the method name, the corresponding method will be opened in the Java editor. Department of Computer Science University of Manitoba Using JUnit in Eclipse www.cs.umanitoba.ca/~eclipse Tutorial 10 Page 6 The bottom of the view shows a stack trace of the method calls leading up to the failure. Here we can see that since we used the assertEquals method, it gives us a message about what the expected value was versus the value received. Double-clicking on the second line from the top of the stack trace will jump to the specific line at which the failure occurred. The error occurred in the testSimplify() method, and it looks as though the absolute value of the result was correct, but the sign was wrong. By commenting out the failed assertion, we can verify that the sign of the denominator is also reversed from what was expected. A simple fix for this is to check if the denominator is ever negative, and if so negate both numerator and denominator, effectively "moving" the negative sign to the denominator. The code for this is commented out in the simplify() method of SimpleFraction.java, so we can uncomment it now. if(denominator < 0) { denominator = -denominator; numerator = -numerator; } This fix is very straightforward. We can be fairly certain it will correct the specific case in question, but will it break our existing code? Since we have our unit tests in place, we make the change, and run the tests again. This time, they run to completion successfully, and a green bar is displayed in the JUnit view. Both our new and pre-existing test cases work, so we may assume that the fix was correct. This raises an important point about the value of unit testing. A suite of tests is only useful if it is both correct and thorough. You may occasionally have a test case fail only to discover that it is the test case that is flawed and not the code being tested. Similarly, if a change to the code breaks functionality that is not covered by the test cases but is used in your actual application, it will take longer to discover. Meanwhile you may continue to make changes that further break existing code. It is therefore important to keep your unit tests up to date as you write new code. Department of Computer Science University of Manitoba Tutorial 10 Page 7 Using JUnit in Eclipse www.cs.umanitoba.ca/~eclipse In the case of our SimpleFraction example above, it would be wise to add some additional simplify() tests with different values and different combinations of negative and positive denominator and numerator to further verify that the change we made behaves as intended. When we later try to add new features to our SimpleFraction class, these existing tests will give us greater confidence in the correctness of any changes. Test Suites Once you have created more than one TestCase, it is useful to be able to group them and run them all together. JUnit has the concept of a TestSuite for doing exactly that. To create a Test Suite in Eclipse, right-click on the package and select New->Other... Select JUnit as before, but choose to create a TestSuite rather than a TestCase. By default, all the classes in the package containing the word "test" will be added to the suite. When you hit Finish, a new class will be created that contains a method that instantiates and returns a TestSuite with all the TestCases you selected. As with individual TestCases, the TestSuite can be launched from the Run menu. You may have noticed the second tab on the JUnit view labeled Hierarchy. This displays the current TestSuite and its contents. In addition to adding individual TestCases to a TestSuite, you can also add TestSuites to a TestSuite. This allows the creation of a more complex, tree-like hierarchy of tests, with TestCases being the leaf nodes and TestSuites Department of Computer Science University of Manitoba Using JUnit in Eclipse www.cs.umanitoba.ca/~eclipse Tutorial 10 Page 8 being the internal nodes. It is this hierarchy that is displayed in the Hierarchy view when a JUnit test or suite is run. In our example we have just the single suite containing the SimpleFractionTest class with two test methods. Conclusion Due to its simplicity and usefulness, JUnit has become nearly ubiquitous in the world of Java, and ports of it exist for nearly every language available (e.g. CppUnit, NUnit, HttpUnit, PHPUnit, etc.) If you wish to learn more about JUnit, consider visiting http://www.junit.org Department of Computer Science University of Manitoba Tutorial 10 Page 9 Using JUnit in Eclipse www.cs.umanitoba.ca/~eclipse
Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

A.T. Still University - CSE - CSE-106
Simulating the Power Consumption of Large-Scale Sensor Network ApplicationsVictor Shnayder, Mark Hempstead, Bor-rong Chen, Geoff Werner Allen, and Matt WelshDivision of Engineering and Applied Sciences Harvard University{shnayder,mhempste,brchen,w
Cornell - BIO - 2810
Cornell - BIO - 2810
1BioGD 281 First Preliminary Exam February 22, 2007 Name Last FirstLab Section and Instructor (or BioGD 280) This exam has 7 questions plus a bonus question on 13 pages. Make sure you have a complete copy before you begin. Two blank pages have be
Cornell - BIO - 2810
Cornell - BIO - 2810
Cornell - BIO - 2810
Concordia NY - ESL - COLLEGE ES
ESL EXCELLENCE INSITUTELISTENING AND VOCABULARY SKILLS DEVELOPMENT LESSONMS. SNYDER, ESL SPECIALISTESLEXCELLENCE@AOL.COM10/18/2008PLEASE PRINT THIS PAGE AND COME TO THE VIRTUAL CLASSROOM READY TO LISTEN AND LEARN OR LISTEN TO THE AUDIO TO COM
Concordia NY - TESOL - COLLEGE ES
THE VIRTUAL CLASSROOM LEGISLATIVE BRANCH OF GOVERNMENThttp:/www.wiziq.com/tutorsession/detail.aspx?id=98F1F7104F914C3D8B3DEE5E3A5B3E931THE VIRTUAL CLASSROOM LINK IS: THE LEGISLATIVE BRANCH Please start at slide 34. You should have audio and the
Florida A&M - CHE - 100
Amber Springer Chemistry OrientationSeptember 12, 2006When I first went to college I planned to be a plastic surgeon and major in biology. As I took my first biology class, I began to realize that I had absolutely no interest in actually doing th
Florida A&M - CHE - 100
Amber Springer Chemistry 102 Environmental Toxicology Studies in California showed that there may be major economic problems due to the use of pesticides and hazardous chemicals. Although the chemicals used to treat pest problems and for the treatmen
Florida A&M - BIO - 191
15.3Monday, November 28, 2005 11:13 PMTranscription in ProkaryotesRNA Polymerase Very Large and Complex consists of 5 subunits 1. Two alpha subunits Regulatory Proteins 1. Beta subunit Ribonucleotide 1. Beta Prime subunit DNA template 1. Sigma s
Florida A&M - BIO - 191
Overview: A World in a Drop of Water Even a low-power microscope Can reveal an astonishing menagerie of organisms in a drop of pond waterFigure 28.1Copyright 2005 Pearson Education, Inc. publishing as Benjamin Cummings50 m These amazing o
Florida A&M - BIO - 191
Chapter 27ProkaryotesPowerPoint Lectures for Biology, Seventh EditionNeil Campbell and Jane ReeceLectures by Chris RomeroCopyright 2005 Pearson Education, Inc. publishing as Benjamin Cummings Overview: They're (Almost) Everywhere! Most pr
Florida A&M - BIO - 191
Chapter 35Plant Structure, Growth, and DevelopmentPowerPoint Lectures for Biology, Seventh EditionNeil Campbell and Jane ReeceLectures by Chris RomeroCopyright 2005 Pearson Education, Inc. publishing as Benjamin Cummings Concept 35.1: The p
Florida A&M - BIO - 191
Protista IIIn laboratory I, you were introduced to animal-like protists (Protozoans), and these organisms were defined by their mobility and heterotrophic nutrition strategy. In this lab we will continue to survey this diverse group of organisms and
Florida A&M - BIO - 191
Protista IPrimitive and ancient members of the Domain Archaea and Eubacteria (both prokaryotes) were the first living organisms to inhabit this planet circa 3.5 billion years ago. Organisms in the Domain Eukaryota evolved some time later, with the f
Florida A&M - BIO - 191
Chapter 32An Introduction to Animal DiversityPowerPoint Lectures for Biology, Seventh EditionNeil Campbell and Jane ReeceLectures by Chris RomeroCopyright 2005 Pearson Education, Inc. publishing as Benjamin Cummings Overview: Welcome to You
Florida A&M - CHE - 100
dmium on M ammalian Cellsect of cadmium t oxicit y on mammalian cells by using t he bact er ia pseudomonas.There are many toxins in the environment that have an effect on mammalian cells. The National Toxicology Program of the Department of Healt
Agnes Scott College - ENG - 233
Amber Springer Eng 235 Professor Bond October 25, 2005 BelovedIn Toni Morrison's novel Beloved, the death and rejuveneation of the life of Sethe is seen. This decay and growth is to to her daughters Beloved and Denver. Denver uses manipulation tkee
Agnes Scott College - ENG - 233
Amber Springer September 13, 2005 Professor Bond English 235In the book Mumbo Jumbo, the writing style, ideas and dialect used by Ishmael Reed were very unique. The book's characters talked about the destruction an unholy religion called Jes Grew w
Agnes Scott College - HIST - 235
Amber Springer History 254 May 2, 2006 Professor Ellen Spears Media and Race Riots: Atlanta, Georgia (1906); Illinois (19081919); Tulsa, Oklahoma (1921); Detroit, Michigan (1943); Los Angeles, California (1965) The struggle for freedom and equality
Florida A&M - CHE - `0`
Kinetics of the Triplet State of a Pd PorphyrinIntroduction Phosphorescence is the spontaneous emission that may persist for long periods of time. In a fluorescence procedure, the initial absorption takes the molecule of choice to an excited electro
Florida A&M - CHE - `0`
Kinetics of the Benzophenone Ketyl Radical Anion Introduction In the presence of NaOH, the free radicals abstracted by the isopropanol solution deprotonate to the conjugate bases and undergo radical-radical termination processes that cause the loss o
Berkeley - MATH - mat 55
Math 55: Discrete MathematicsUC Berkeley, Spring 2009 Solutions to Homework # 9 (due February 18)7.1 # 5 r2 - 8r + 16 = (r - 4)2 , so the general solution is c1 4n + c2 n4n . a. c1 = c2 = 0, yes. b. No. c. No. d. Yes. e. Yes. f. Yes. g. No. h. No.
Berkeley - MATH - 55
Solutions to Homework 1.Math 55, Fall 2006. Prob 1.1.24. (a) Converse: If I stay home, then it will snow tonight. Contrapositive: If I do not stay at home, then it will not snow tonight. (b) Converse: Whenever I go to the beach, it is a sunny summer
Metro State - MGMT - 499
1. What are the dominant strategy-shaping economic characteristics of the digital music player industry (DMPI)? The largest strategy-shaping economic characteristic is the market share and growth rate. In 2006, over 13.6 million digital music players
UC Riverside - BUS 100 - 100
Ch. 1 Know the definitions of Strategy. Strategy: management's action plan for running the business and conducting operations. The crafting of a strategy represents a managerial commitment to pursue a particular set of actions in growing the busine
UC Riverside - BUS 100 - 100
Chatper 1 1. What factors affect the communication level in an organization a) nature of the business b) the operating plan c) its environment d) the geographic dispersion of its members e) its people f) its organizational culture 2. What are the typ
UC Riverside - BUS 112 - 112
CHAPTER 8Memory and RetrievalCHAPTER OUTLINEI. What Is Memory? A. Knowledge, Attitudes, and Memory 1. Memory and retrieval are affected by attention, categorization, and comprehension, and by attitude formation processes. B. Memory, Retrieval, a
UC Riverside - BUS 100 - 100
Chapter 6 What are the four parts of planning for a business message? Use Direct organizational pattern Access your reader's probable reaction to what you have to say. Begin with your objective. For instance, if you are asking for information, sta
UC Riverside - BUS 118 - 118
MIDTERM EXAM BUS 118 Electronic Marketing April 29, 2009 Format:PART 1 MULTIPLE CHOICE. 31 questions, 2 points each, 62 points total PART 2 MATCHING. 2 questions, 4 points each, 8 points total PART 3 SHORT ANSWER. 5 questions (note: only your be
UC Riverside - BUS 100 - 100
MidTerm ExamOctober 29, Business 100 Instructions:1. Remove all items except for your scantron, pencils, and the exam from your desk. Place all items underneath your desk. Please make sure your cell phones, lap top and other devices are off.
UC Riverside - BUS 118 - 118
MIDTERM EXAM BUS 118 Electronic Marketing April 29, 2009 Format:PART 1 MULTIPLE CHOICE. 31 questions, 2 points each, 62 points total PART 2 MATCHING. 2 questions, 4 points each, 8 points total PART 3 SHORT ANSWER. 5 questions (note: only your be
UC Riverside - BUS 109 - 109
Ch. 1 Know the definitions of Strategy. Strategy: management's action plan for running the business and conducting operations. The crafting of a strategy represents a managerial commitment to pursue a particular set of actions in growing the busine
UC Riverside - BUS 115 - 115
FINAL EXAM PRACTICE QUESTIONS (SHORT ANSWER / CALCULATIONS) 1. Professor Godfrey wants to know the mean number of hours per week students spend preparing for her class, plus or minus 1 hour. Since she needs to report this information to the Dean, she
UC Riverside - BUS 102 - 102
Exam Questions 1. Define and discuss the strengths and weaknesses of the pluralistic society. Identify and discuss the central components of the stakeholder environment. How might the stakeholder approach to business management improve sustainability
UC Riverside - BUS 102 - 102
Library session Rm 149 Rivera 04/20 9am 04/21 11am 04/22 1pm 04/23 9am 04/24 10am Conclusion of part 1 4 important ethics questions: 1. What is? 2. What ought to be? 3. How do we get from what is to what ought to be? 4. What is our motivation in all
UC Riverside - BUS 112 - 112
EXAM 1 STUDY OUTLINECHAPTER 2 (LECTURE 2)Developing and Using Information About Consumer BehaviorI0. Consumer Behavior Research Methods0 A0. Many tools are available for the consumer researcher to use.0 10. A survey is a written instrument that
UC Riverside - BUS 100 - 100
Practice Final 1. Preceding a refusal with an apology (such as &quot;I deeply regret that.&quot;) is a positive way of handling refusals. A) True B) False 2. An ideal average sentence length in writing for the middle-level adult reader is 8 to 10 words A) True
UC Riverside - BUS 109 - 109
Final ReviewCh.5 to 7*Ch.1 to 4 (See Midterm Review) Know what are the FIVE generic strategies companies can choose to compete. (See Figure 5.1)1) 2) 3) 4) 5) Low Cost Provider A focused (or market niche) strategy Best cost provider strategy A b
UC Riverside - BUS 118 - 118
MIDTERM EXAM BUS 118 Electronic Marketing April 29, 2009 Format: PART 1 MULTIPLE CHOICE. 31 questions, 2 points each, 62 points total PART 2 MATCHING. 2 questions, 4 points each, 8 points total PART 3 SHORT ANSWER. 5 questions
UC Riverside - BUS 101 - 101
Second Exam Date &amp; Time: Tuesday, February 17, 5:10 6:30pm Format: You can expect the following types of questions: true/false &amp; multiple choice questions. You will have 1 hour 20 minutes to complete the exam. It will be closed book and closed notes
Adelphi - ACCT - 321
1 a. Revenues Variable costs Fixed costs Operating income b. Contribution margin$2,500,000 1,500,000 900,000 100,000 = Contribution margin per unit X # of units sold = $0.20 X 5,000,000 = = Fixed costs Contribution margin % $2,500,000 1,700,000 900
Troy - POL - 2241
Seth Norton POL2241 Brown Chapter 7: Public Opinion1. Define the following terms: Elite-People who have a disproportionate amount of some valued resource exit polls-Polls based on interviews conducted on Election day with randomly selected voters g
Troy - POL - 2241
Seth R. Norton POL2241 BrownCHAPTER 13: Congress1. Please define the following terms: bicameral legislature A lawmaking body made up of two chambers or parts. Caucus- An association of Congress members created to advance a political ideology or i
Troy - POL - 2241
Seth R. Norton POL2241 BrownPOL 2241 Final Exam A major difference between presidential campaigns and congressional campaigns is that D) 2. 3. 4. 5. 6. presidential races are generally more competitive. The elections that produce the largest voter t
Troy - POL - 2241
Seth Norton POL 2241 Brown Chapter 5: Civil Liberties 1. Please define the following terms: Clear and present danger test- Law should not punish speech unless there was a clear and present danger of producing harmful actions. Due process of law- Deni
Troy - POL - 2241
Seth R. Norton POL2241 Brown 1. Define the following terms: 527 organizations- Organizations that under section 527 of the Internal revenue Code, Raises and spends money to advance political causes. blanket primary- A primary election in which each v
Troy - ACCT - 2292
MULTIPLE CHOICEChapter 1 Practice Materials1. Profit is the difference between a. assets and liabilities b. the incoming cash and outgoing cash c. the assets purchased with cash contributed by the owner and the cash spent to operate the business
Troy - ACCT - 2292
Chapter 2-Analyzing TransactionsMULTIPLE CHOICE 1. Accounts a. do not reflect money amounts b. are not used by entities that manufacture products c. are records of increases and decreases in individual financial statement items d. are only used by l
Troy - ACCT - 2292
Chapter 3-The Adjusting ProcessMULTIPLE CHOICE 1. The revenue recognition concept a. is in not in conflict with the cash method of accounting b. determines when revenue is credited to a revenue account c. states that revenue is not recorded until th
Troy - ACCT - 2292
Chapter 3-The Adjusting ProcessMULTIPLE CHOICE 1. The revenue recognition concept a. is in not in conflict with the cash method of accounting b. determines when revenue is credited to a revenue account c. states that revenue is not recorded until th
Troy - ACCT - 2292
Chapter 4-Completing the Accounting CycleMULTIPLE CHOICE 1. In the accounting cycle, the last step is a. preparing the financial statements b. journalizing and posting the adjusting entries c. preparing a post-closing trial balance d. journalizing a
Troy - ACCT - 2292
Chapter 6-Accounting for Merchandising BusinessesMULTIPLE CHOICE 1. Which one of the following is not a difference between a retail business and a service business? a. in what is sold b. the inclusion of gross profit in the income statement c. accou
Troy - ACCT - 2292
Chapter 7-InventoriesMULTIPLE CHOICE 1. Under a perpetual inventory system, the amount of each type of merchandise on hand is available in the a. customer's ledger b. creditor's ledger c. inventory ledger d. merchandise inventory account ANS: C DIF:
Troy - ACCT - 2292
Chapter 8 -Sarbanes Oxley, Internal Control, &amp; CashMULTIPLE CHOICE 1. Which one of the following below is not an element of internal control? a. risk assessment b. monitoring c. information and communication d. behavior analysis ANS: D DIF: Easy OBJ
Troy - ACCT - 2292
Chapter 9-ReceivablesMULTIPLE CHOICE 1. A note receivable due in 18 months is listed on the balance sheet under the caption a. long-term liabilities b. fixed assets c. current assets d. investments ANS: D DIF: Easy OBJ: 09-01 NAT: AACSB Analytic | A
Troy - ACCT - 2292
Chapter 10-Fixed Assets and Intangible AssetsMULTIPLE CHOICE 1. A characteristic of a fixed asset is that it is a. intangible b. used in the operations of a business c. held for sale in the ordinary course of the business d. a long term investment A
Troy - ACCT - 2292
Chapter 11-Current Liabilities and PayrollMULTIPLE CHOICE 1. Current liabilities are a. due, but not receivable for more than one year b. due, but not payable for more than one year c. due and receivable within one year d. due and payable within one
Troy - ACCT - 2292
Chapter 12-Accounting for Partnerships and Limited Liability CompaniesMULTIPLE CHOICE 1. Which of the following is characteristic of a general partnership? a. The partners have co-ownership of partnership property. b. The partnership is subject to f
Troy - ACCT - 2292
Chapter 13-Corporations: Organization, Capital Stock Transactions, and DividendsMULTIPLE CHOICE 1. Which of the following is not characteristic of a corporation? a. The financial loss that a stockholder may suffer from owning stock in a public compa