Skip to content

Commit 0dbe6dc

Browse files
authored
Merge branch 'exercise/completed' into GP-26_Add_compleated_solution_to_exercise/completed
2 parents 041c6df + 54f3773 commit 0dbe6dc

File tree

14 files changed

+272
-0
lines changed

14 files changed

+272
-0
lines changed

2-0-data-structures-and-algorithms/src/main/java/com/bobocode/linked_list/LinkedList.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import java.util.NoSuchElementException;
44
import java.util.Objects;
55
import java.util.stream.Stream;
6+
import com.bobocode.util.ExerciseNotCompletedException;
67

78
/**
89
* {@link LinkedList} is a list implementation that is based on singly linked generic nodes. A node is implemented as

3-0-java-core/pom.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
55
<modelVersion>4.0.0</modelVersion>
6+
<dependencies>
7+
<dependency>
8+
<groupId>com.bobocode</groupId>
9+
<artifactId>java-fundamentals-util</artifactId>
10+
<version>1.0-SNAPSHOT</version>
11+
<scope>compile</scope>
12+
</dependency>
13+
</dependencies>
614

715
<parent>
816
<groupId>com.bobocode</groupId>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.bobocode.file_reader;
2+
3+
import com.bobocode.util.ExerciseNotCompletedException;
4+
5+
/**
6+
* {@link FileReaders} provides an API that allow to read whole file into a {@link String} by file name.
7+
*/
8+
public class FileReaders {
9+
10+
/**
11+
* Returns a {@link String} that contains whole text from the file specified by name.
12+
*
13+
* @param fileName a name of a text file
14+
* @return string that holds whole file content
15+
*/
16+
public static String readWholeFile(String fileName) {
17+
throw new ExerciseNotCompletedException(); //todo
18+
}
19+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package com.bobocode.file_reader;
2+
3+
import com.bobocode.file_reader.FileReaders;
4+
import org.junit.jupiter.api.Test;
5+
6+
import static org.junit.jupiter.api.Assertions.assertEquals;
7+
8+
9+
public class FileReadersTest {
10+
11+
@Test
12+
void testReadWholeFileOnEmptyFile() {
13+
String fileContent = FileReaders.readWholeFile("empty.txt");
14+
15+
assertEquals("", fileContent);
16+
17+
}
18+
19+
@Test
20+
void testReadWholeFileOnFileWithEmptyLines() {
21+
String fileContent = FileReaders.readWholeFile("lines.txt");
22+
23+
assertEquals("Hey!\n" +
24+
"\n" +
25+
"What's up?\n" +
26+
"\n" +
27+
"Hi!", fileContent);
28+
}
29+
30+
@Test
31+
void testReadWholeFile() {
32+
String fileContent = FileReaders.readWholeFile("simple.txt");
33+
34+
assertEquals("Hello!\n" + "It's a test file.", fileContent);
35+
}
36+
}

3-0-java-core/src/test/resources/empty.txt

Whitespace-only changes.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Hey!
2+
3+
What's up?
4+
5+
Hi!
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Hello!
2+
It's a test file.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# <img src="https://raw.githubusercontent.com/bobocode-projects/resources/master/image/logo_transparent_background.png" height=50/>Java OOP exercises
2+
The list of exercises dedicated to training your OOP skills in Java
3+
4+
### No pain, No gain :heavy_exclamation_mark:
5+
6+
> Skill is only developed by hours and hours and hours of beating on your craft
7+
8+
Working on real problems, you're focused on finding a solution. Learning new things, you're trying to understand how it works.
9+
It is important to have a different type of activities, which purpose is improving your skill
10+
11+
***An exercise** is a predefined task that you continuously implement to improve a certain skill* :muscle:
12+
##
13+
* [Flights search](https://github.com/bobocode-projects/java-oop-exercises/tree/master/flight-search-simple)
14+

4-0-object-oriented-programming/pom.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
55
<modelVersion>4.0.0</modelVersion>
6+
<dependencies>
7+
<dependency>
8+
<groupId>com.bobocode</groupId>
9+
<artifactId>java-fundamentals-util</artifactId>
10+
<version>1.0-SNAPSHOT</version>
11+
<scope>compile</scope>
12+
</dependency>
13+
</dependencies>
614

715
<parent>
816
<groupId>com.bobocode</groupId>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# <img src="https://raw.githubusercontent.com/bobocode-projects/resources/master/image/logo_transparent_background.png" height=50/>Flight search exercise :muscle:
2+
Improve your OOP skills
3+
### Task
4+
`FlighService` and package `service` represent a component of the system that holds a business logic. `FlightDao`
5+
and package `data` represent a component of the system that implements data access layer. Your job is to implement
6+
the *todo* section of those classes **following OOP design principles.**
7+
8+
To verify your implementation, run `FlightSeriviceTest.java`
9+
10+
### Pre-conditions :heavy_exclamation_mark:
11+
You're supposed to be familiar with Java and OOP
12+
13+
### How to start :question:
14+
* Just clone the repository and start implementing the **todo** section, verify your changes by running tests
15+
* If you don't have enough knowladge about this domain, check out the [links below](#related-materials-information_source)
16+
* Don't worry if you got stuck, checkout the **exercise/completed** branch and see the final implementation
17+
18+
### Related materials :information_source:
19+
* [SOLID](https://en.wikipedia.org/wiki/SOLID)
20+
21+

0 commit comments

Comments
 (0)