Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need someone to check if my assertions are correct. I did test them and they worked fine, but there are still some concerns that
I need someone to check if my assertions are correct. I did test them and they worked fine, but there are still some concerns that I commented on my test class attached below
And here is my code for the ComplexClass
And for the ComplexCalculator class
eclipse-workspace-CS18284-L File Edit Scurce Refatr Navigate Search Preject Rur Winduw Help E Navigator JUnit & , e-lAEl q, 9, | 1 package test . c st8284. calculator ; Finishod after 185.764 scconds 3import static org-junitAssert.; Errors: 0 Failures: 0 1. Use assertNotul) to test thr Complex(doublr, douhle) ranstructorl test.cst8284 calculator.TestComplex [Runner JUnit 4 2. Use asserttquals (double, double, double) to test if geteal) returns the correct value set using the Complex(int, int) constructor 9 3. Use assertEquals(double, double, double) to test if setReal) errectly resets the value set using the Conplex(double, double) censLructor 1 4 . Ikr the no-are cnmlex() constructor, and then use the rral and imaginary setter to set nm. intreer values 12 Then use asser LTrue(boolean) Lo test the validity of your nely-aded equals(in, int) neLhed 1 sing assertTrue(hoolran), test that tun Complrx numbers rreatrd using the Complex(Stringl]) canstructor and thr Conplex(Strine, String) 15 cens tructor give the correct result using the multiply ed Use equals (Complex) to compare the actual and expected result 6.Divide tun Complex nunhers and use thr result to test your equals(ouhle experted, double actual, double drlta) nethod, with delta -.001 import are. junit.Test; 21 22 import cst8284.calculator.Conplex; 3 import cst828 rallator.canplexCalrulatar; 24 25 publ1c class estonplex >126 27 Test hailure Irace #28 public void testLomplextonstructor() { 09 1e 31 Complex now Complrx (3.0, 7.0); asserCNotmill(); 33 Test |14 public void testoetReal(){ Complex nw Capx3, ); assertEquals(c.getReal), 3, 1-5); 16 9 Test 49 public void testsetReal() { Complex-naw Coprx3., .0); c.setReal(); double a c.getReal(); assertFquais(a, A, IF-14); 43 45 Smart Insert 5:73 eclipse-workspace-CS18284-L File Edit Scurce Refatr Navigate Search Preject Rur Winduw Help E Navigator JUnit & , e-lAEl q, 9, | 1 package test . c st8284. calculator ; Finishod after 185.764 scconds 3import static org-junitAssert.; Errors: 0 Failures: 0 1. Use assertNotul) to test thr Complex(doublr, douhle) ranstructorl test.cst8284 calculator.TestComplex [Runner JUnit 4 2. Use asserttquals (double, double, double) to test if geteal) returns the correct value set using the Complex(int, int) constructor 9 3. Use assertEquals(double, double, double) to test if setReal) errectly resets the value set using the Conplex(double, double) censLructor 1 4 . Ikr the no-are cnmlex() constructor, and then use the rral and imaginary setter to set nm. intreer values 12 Then use asser LTrue(boolean) Lo test the validity of your nely-aded equals(in, int) neLhed 1 sing assertTrue(hoolran), test that tun Complrx numbers rreatrd using the Complex(Stringl]) canstructor and thr Conplex(Strine, String) 15 cens tructor give the correct result using the multiply ed Use equals (Complex) to compare the actual and expected result 6.Divide tun Complex nunhers and use thr result to test your equals(ouhle experted, double actual, double drlta) nethod, with delta -.001 import are. junit.Test; 21 22 import cst8284.calculator.Conplex; 3 import cst828 rallator.canplexCalrulatar; 24 25 publ1c class estonplex >126 27 Test hailure Irace #28 public void testLomplextonstructor() { 09 1e 31 Complex now Complrx (3.0, 7.0); asserCNotmill(); 33 Test |14 public void testoetReal(){ Complex nw Capx3, ); assertEquals(c.getReal), 3, 1-5); 16 9 Test 49 public void testsetReal() { Complex-naw Coprx3., .0); c.setReal(); double a c.getReal(); assertFquais(a, A, IF-14); 43 45 Smart Insert 5:73Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started