/
TDD FileLoader v1.3.
TDD FileLoader v1.3.
Unit test modified so it is build pipeline friendly and does not break the tenants of good Unit Testing
The Unit Test
// Redesign has worked so this test uses a stub to simulate a file being
// loaded, it is passed in as lambda - We've decoupled ourselves from the
// filesystem
@Test
public void load_all_of_file_via_stub()
{
// arrange
String fileToLoad = "";
FileLoader cut = new FileLoader(fileToLoad);
int expectedBytesRead = 10;
// act
int bytesRead = cut.loadFile((fname) ->
{
List<String> result = new ArrayList<>();
result.add("Hello");
result.add("world");
return result;
});
// assert
assertEquals(expectedBytesRead, bytesRead);
}
, multiple selections available,
Related content
TDD FileLoader v1.2.
TDD FileLoader v1.2.
More like this
TDD FileLoader v1.4.
TDD FileLoader v1.4.
More like this
TDD FileLoader v1.0.
TDD FileLoader v1.0.
More like this
QL-4) Using TDD to design production code.
QL-4) Using TDD to design production code.
More like this
QLC-3) Writing Results to a File.
QLC-3) Writing Results to a File.
Read with this
Full complete versions of the code
Full complete versions of the code
More like this