java - Junit Positive and Negative Testing -


I have an assignment in which I need to make some tests for my code, we will have to use junit tests, so I Have decided to test positive and negative of their methods.

For example, to get names from an ArrayList, I have been tested positive and negative:

Postiv:

  Public Zero TestGate Name () {Entrance entry = 1 new entry ("Susan Holmes", "122 Harringdale", "Workingington," "CA14 2GH"); AssertEquals ("Susan Holmes", entry1.getName ()); Negative:  
  Public Zero testGetNameNegative () {Entry entry 1 = New entry ("Susan Holmes", "122 Harringdale", "Workington" , "CA14 2GH"); AssertFalse (entry1.getName () == "Alison"); I am not sure about this exam:  
  Public Zero Test Entry () {Entry Entry = 1 New Entry ("Susan Holmes" , "122 Harringdale", "Workingington", "CA14 2GH"); AssertNotNull (ENTRY1); }   

Is there any negative examination on this?

The entry class public constructor is considered to be some logical validation, such as the name can not be null. Then you can write such a negative test

Note that I have been using Genuine 4

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -