So I have this lab due where I have to make a basic class with some constructors for getting the points in a space… I seem to have struggled to write most of my code , but my test case is giving me an error that states the following….

“java.lang.NoSuchMethodException: Point.getRadius()”

Can anyone help me understand where i went wrong in my code ?

**MY Code**

```
public class Point {
//X and Y cordinates
private double x;
private double y;
//Constructor
public Point(double x, double y) {
super();
this.x = x;
this.y = y;
}
//getters
public double getX() {
return x;
}
public double getY() {
return y;
}
//Method to find radius of point from the Origin point, which is
//passed as argument
public double getRadius(Point origin){
double a = this.getX() - origin.getX();
double b = this.getY() - origin.getY();
return Math.sqrt(a*a + b*b);
}
//Method to find angle of point with respect to x-axis
public double getAngle(){
//atan function of Math class is used to find the angle
//in the range -pi/2 through pi/2, multiply by 180 and
//divide by PI to convert into radian
return Math.atan(this.y/this.x) * 180 / Math.PI;
}
//Method to find a point which is rotated 90 of current point from origin
public Point rotate90(Point origin){
//these formulas are used to calculate X and Y coordinates of new point
double newX = origin.getX() + (this.getX()-origin.getX())*Math.cos(90) - (this.getY()-origin.getY())*Math.sin(90);
double newY = origin.getY() + (this.getX()-origin.getX())*Math.sin(90) + (this.getY()-origin.getY())*Math.cos(90);
return new Point(newX, newY);
}
}
```

**Now Here are my test cases**

```
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.lang.reflect.Field;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import org.junit.Test;
public class TestCases
{
public static final double DELTA = 0.00001;
/*
* This test is just to get you started.
*/
@Test
public void testGetX()
{
assertEquals(1.0, new Point(1.0, 2.0).getX(), DELTA);
}
/*
* The tests below here are to verify the basic requirements regarding
* the "design" of your class. These are to remain unchanged.
*/
@Test
public void testImplSpecifics()
throws NoSuchMethodException
{
final List<String> expectedMethodNames = Arrays.asList(
"getX",
"getY",
"getRadius",
"getAngle",
"rotate90"
);
final List<Class> expectedMethodReturns = Arrays.asList(
double.class,
double.class,
double.class,
double.class,
Point.class
);
final List<Class[]> expectedMethodParameters = Arrays.asList(
new Class[0],
new Class[0],
new Class[0],
new Class[0],
new Class[0]
);
verifyImplSpecifics(Point.class, expectedMethodNames,
expectedMethodReturns, expectedMethodParameters);
}
private static void verifyImplSpecifics(
final Class<?> clazz,
final List<String> expectedMethodNames,
final List<Class> expectedMethodReturns,
final List<Class[]> expectedMethodParameters)
throws NoSuchMethodException
{
assertEquals("Unexpected number of public fields",
0, Point.class.getFields().length);
final List<Method> publicMethods = Arrays.stream(
clazz.getDeclaredMethods())
.filter(m -> Modifier.isPublic(m.getModifiers()))
.collect(Collectors.toList());
assertEquals("Unexpected number of public methods",
expectedMethodNames.size(), publicMethods.size());
assertTrue("Invalid test configuration",
expectedMethodNames.size() == expectedMethodReturns.size());
assertTrue("Invalid test configuration",
expectedMethodNames.size() == expectedMethodParameters.size());
for (int i = 0; i < expectedMethodNames.size(); i++)
{
Method method = clazz.getDeclaredMethod(expectedMethodNames.get(i),
expectedMethodParameters.get(i));
assertEquals(expectedMethodReturns.get(i), method.getReturnType());
}
// verify that fields are final
final List<Field> nonFinalFields = Arrays.stream(
clazz.getDeclaredFields())
.filter(f -> !Modifier.isFinal(f.getModifiers()))
.collect(Collectors.toList());
assertEquals("Unexpected non-final fields", 0, nonFinalFields.size());
}
}
```