This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var arr = [ | |
{ name: "A", value: 10 }, | |
{ name: "B", value: 20 }, | |
{ name: "C", value: 30 }, | |
{ name: "A", value: 40 }, | |
{ name: "B", value: 50 }, | |
{ name: "C", value: 60 }]; | |
var accumulated = arr.reduce(function(accumulator, element) { | |
var currentValue = accumulator[element.name]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<dependency> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-devtools</artifactId> | |
<optional>true</optional> | |
</dependency> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm install webpack --save-dev | |
npm install webpack -g |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm install babel-loader babel-core --save-dev | |
npm install babel-cli babel-preset-es2015 --save-dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
entry: './js/app.js', | |
output: { | |
path: './build', | |
filename: 'bundle.js' | |
}, | |
module: { | |
loaders: [ | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
{ | |
test: /\.css$/, | |
exclude: /node_modules/, | |
loader: 'style-loader!css-loader' | |
}, | |
{ | |
test: /\.scss$/, | |
exclude: /node_modules/, | |
loader: 'style-loader!css-loader!saas-loader' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public double totalAmount(List<Items> items) { | |
double total = 0.0; | |
for (item : items) { | |
if (item.getCategory() == "DISCOUNT") { | |
total += 0.95 * item.getPrice(); | |
} | |
else if (item.getCategory() == "WEIGHT") { | |
total += item.getQuantity()*5/1000); | |
} | |
else if (item.getCategory() =="SPECIAL") { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public double totalAmount(List<Items> items) { | |
double total = 0.0; | |
for (item : items) { | |
total += item.getPrice(); | |
} | |
return total; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test(expected = IllegalArgumentException.class) | |
public void exceptionTesting() { | |
try { | |
throw new IllegalArgumentException("id must not be null"); | |
} | |
catch(IllegalArgumentException iae) { | |
assertEquals("id must not be null", iae.getMessage()); | |
throw iae; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Rule | |
public ExpectedException thrown = ExpectedException.none(); | |
@Test | |
public void shouldThrowExpectedException(){ | |
thrown.expect(IllegalArgumentException.class); | |
thrown.expectMessage("id must not be null"); | |
throw new IllegalArgumentException("id must not be null"); | |
} |