minor cleanup

This commit is contained in:
eugenp 2016-01-26 12:02:21 +02:00
parent da40afeeeb
commit 9de8a4a436
3 changed files with 9 additions and 10 deletions

View File

@ -53,7 +53,7 @@ public class Computer {
}
public Double calculateValue(Double initialValue) {
return initialValue/1.50;
return initialValue / 1.50;
}
@Override

View File

@ -2,8 +2,7 @@ package com.baeldung.doublecolon;
import java.util.function.Function;
public class MacbookPro extends Computer{
public class MacbookPro extends Computer {
public MacbookPro(int age, String color) {
super(age, color);
@ -24,12 +23,12 @@ public class MacbookPro extends Computer{
}
@Override
public Double calculateValue(Double initialValue){
public Double calculateValue(Double initialValue) {
Function<Double,Double> function = super::calculateValue;
Function<Double, Double> function = super::calculateValue;
final Double pcValue = function.apply(initialValue);
System.out.println("First value is:" +pcValue);
return pcValue + (initialValue/10) ;
System.out.println("First value is:" + pcValue);
return pcValue + (initialValue / 10);
}
}

View File

@ -80,10 +80,10 @@ public class TestComputerUtils {
public void testSuperMethodReference() {
final TriFunction<Integer, String, Integer, MacbookPro> integerStringIntegerObjectTriFunction = MacbookPro::new;
final MacbookPro macbookPro = integerStringIntegerObjectTriFunction.apply(2010, "black",100);
Double initialValue=new Double(999.99);
final MacbookPro macbookPro = integerStringIntegerObjectTriFunction.apply(2010, "black", 100);
Double initialValue = new Double(999.99);
final Double actualValue = macbookPro.calculateValue(initialValue);
Assert.assertEquals(766.659, actualValue,0.0);
Assert.assertEquals(766.659, actualValue, 0.0);
}
}