Ben Chuanlong Du's Blog

It is never too late to learn.

Fix Xcrun Error in Mac

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

xcode-select --install

Reference

https://apple.stackexchange.com/questions/254380/why-am-i-getting-an-invalid-active-developer-path-when-attempting-to-use-git-a

Loops in Java

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

  1. The condition(s) in a regular for or while loop is recomputed before each iteration. Not only the change of loop variables but also other variables involved in the loop condition …

Kotlin Unit Testing

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

Use Java reflection to help test private methods.

https://phauer.com/2018/best-practices-unit-testing-kotlin/

https://medium.com/mindorks/how-to-unit-test-private-methods-in-java-and-kotlin-d3cae49dccd

Java Unit Testing

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

import static org.junit.Assert.*;

assertEquals

assertArrayEquals

Use reflection to test private methods.

References

https://javarevisited.blogspot.com/2018/09/junit-testing-tips-constructor-is-called-before-test-methods.html

https://medium.com/mindorks/how-to-unit-test-private-methods-in-java-and-kotlin-d3cae49dccd