Skip to content

Commit

Permalink
Chore: ran spotless apply to ensure code was up to formating standard
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohamed committed Mar 14, 2024
1 parent e473bf2 commit 8564356
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 40 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.codedifferently.lesson7.MohamedObjects.Main;


public class CPU extends Parts {
double clockSpeed;
int cores;
Expand All @@ -14,6 +13,7 @@ public CPU(String name, int releaseYear, cpuBrands brand, double clockSpeed) {
this.brand = brand.toString();
this.clockSpeed = clockSpeed;
}

public CPU(String name, int releaseYear, cpuBrands brand, double clockSpeed, int cores) {
this.name = name;
checkValidYear(releaseYear);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
package com.codedifferently.lesson7.MohamedObjects.Main;

import java.util.EnumMap;
import java.util.EnumSet;
import java.util.HashSet;
import java.util.Set;

enum empty{

}

enum empty {}

public class GPU extends Parts {

Expand All @@ -28,7 +23,6 @@ public GPU(String name, int releaseYear, String brand, int vRam) {
this.brand = brand;
}


public GPU(String name, int releaseYear, String brand, int vRam, boolean hasRayTracing) {
this.vRam = vRam;
this.name = name;
Expand All @@ -40,26 +34,28 @@ public GPU(String name, int releaseYear, String brand, int vRam, boolean hasRayT
public void setvRam(int vRam) {
this.vRam = vRam;
}

public void setHasRayTracing(boolean hasRayTracing) {
this.hasRayTracing = hasRayTracing;
this.hasRayTracing = hasRayTracing;
}

public int getvRam() {
return vRam;
}

public Set<portTypes> getPorts() {
return ports;
}

public void addPorts(portTypes port) {
this.ports.add(port);
}
public int printNumPorts(){

public int printNumPorts() {
int i = 0;
for (portTypes a : ports){
for (portTypes a : ports) {
i++;
}
return i;
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.codedifferently.lesson7.MohamedObjects.Main;

public enum cpuBrands{
AMD, INTEL, APPLE
}
public enum cpuBrands {
AMD,
INTEL,
APPLE
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.codedifferently.lesson7.MohamedObjects.Main;

public enum portTypes {
VGA,
DVI,
HDMI,
DP
}
VGA,
DVI,
HDMI,
DP
}
Original file line number Diff line number Diff line change
@@ -1,33 +1,27 @@
package com.codedifferently.lesson7;




import static org.junit.jupiter.api.Assertions.assertTrue;

// import java.lang.reflect.Method;

import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;

import com.codedifferently.lesson7.MohamedObjects.Main.CPU;
import com.codedifferently.lesson7.MohamedObjects.Main.GPU;
import com.codedifferently.lesson7.MohamedObjects.Main.IllegalYearExeption;
import com.codedifferently.lesson7.MohamedObjects.Main.cpuBrands;
import com.codedifferently.lesson7.MohamedObjects.Main.portTypes;

import java.util.*;
import org.junit.jupiter.api.Test;

class MohamedTest {

@Test
public void setClockSpeed(){
CPU cpu = new CPU("cpu1", 2000, cpuBrands.INTEL ,23.32);
assertEquals(23.32,cpu.getClockSpeed());
public void setClockSpeed() {
CPU cpu = new CPU("cpu1", 2000, cpuBrands.INTEL, 23.32);
assertEquals(23.32, cpu.getClockSpeed());
}

@Test
void gpuReleaseYear() throws IllegalYearExeption{
void gpuReleaseYear() throws IllegalYearExeption {
GPU aGpu = new GPU();
try {
aGpu.setReleaseYear(1999);
Expand All @@ -38,9 +32,9 @@ void gpuReleaseYear() throws IllegalYearExeption{
}

@Test
void testGpuPorts(){
Set<portTypes> porty = Set.of(portTypes.DP, portTypes.HDMI, portTypes.VGA );
void testGpuPorts() {

Set<portTypes> porty = Set.of(portTypes.DP, portTypes.HDMI, portTypes.VGA);
GPU bGpu = new GPU("Radion 560 xt", 2015, "AMD", 8);
bGpu.addPorts(portTypes.DP);
bGpu.addPorts(portTypes.HDMI);
Expand All @@ -49,17 +43,18 @@ void testGpuPorts(){
}

@Test
void testSize(){
void testSize() {
GPU bGpu = new GPU("GTX 1050", 2015, "Navidia", 8);
bGpu.addPorts(portTypes.DP);
bGpu.addPorts(portTypes.HDMI);
bGpu.addPorts(portTypes.VGA);
assertEquals(bGpu.printNumPorts(), 3 );
assertEquals(bGpu.printNumPorts(), 3);
}

@Test
void testCores(){
void testCores() {
CPU m1 = new CPU("M1", 2020, cpuBrands.APPLE, 4.0, 8);
assertEquals(m1.getCores(), 8);;
assertEquals(m1.getCores(), 8);
;
}
}

0 comments on commit 8564356

Please sign in to comment.