JUnit Asserts & Annotations

JUnit Asserts & Annotations

12th Grade

16 Qs

quiz-placeholder

Similar activities

X PH 1

X PH 1

9th - 12th Grade

16 Qs

Unit 1 Customer Service

Unit 1 Customer Service

12th Grade

13 Qs

Economics

Economics

12th Grade

20 Qs

Historian and Archaeologist

Historian and Archaeologist

9th - 12th Grade

21 Qs

Cause -Effect Relationship

Cause -Effect Relationship

12th Grade

20 Qs

types of chemical bond

types of chemical bond

9th Grade - University

18 Qs

Sampling Techniques

Sampling Techniques

12th Grade

17 Qs

whos most likely to?

whos most likely to?

9th - 12th Grade

15 Qs

JUnit Asserts & Annotations

JUnit Asserts & Annotations

Assessment

Quiz

Others

12th Grade

Hard

Created by

Luis Mendoza

FREE Resource

16 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of JUnit Asserts?

To slow down the testing process

To verify the expected behavior of the code being tested.

To confuse the developers

To provide entertainment

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What annotation is used to indicate that a method is a test method in JUnit?

@Method

@Test

@TestMethod

@JUnitTest

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How can you check if two objects are equal in JUnit?

assertTrue(expectedObject.equals(actualObject))

assertEquals(expectedObject, actualObject)

assertSame(expectedObject, actualObject)

assertNotEquals(expectedObject, actualObject)

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the use of @Before annotation in JUnit?

It is used to run a method before each test method in the class.

It is used to run a method after each test method in the class.

It is used to skip a test method in the class.

It is used to define the order of test methods execution in the class.

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Explain the difference between assertEquals and assertSame in JUnit.

assertEquals is used to compare values, assertSame is used to compare references.

assertEquals is used for arrays, assertSame is used for objects.

assertEquals compares references, assertSame compares values.

assertEquals is used for strings, assertSame is used for integers.

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the significance of @After annotation in JUnit?

It is used to define the order of test methods execution in the class.

It is used to skip a test method in the class.

It is used to run a method before each test method in the class.

It is used to run a method after each test method in the class.

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How can you ignore a test method in JUnit?

excludeTest

@Ignore

@IgnoreMethod

skipTest

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?