-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(processor): add prove that records are supported by the differen…
…t strategies
- Loading branch information
1 parent
94e4403
commit f978c25
Showing
7 changed files
with
199 additions
and
33 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
47 changes: 47 additions & 0 deletions
47
...s/Strategies/StepWise/RecordsAreBuildable/Expected_DefaultRecordsAreBuildableBuilder.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package io.jonasg.bob.test; | ||
|
||
import java.lang.String; | ||
|
||
public final class DefaultRecordsAreBuildableBuilder implements RecordsAreBuildableBuilder.BuildStep, RecordsAreBuildableBuilder.EngineSizeStep, RecordsAreBuildableBuilder.IsElectricStep, RecordsAreBuildableBuilder.YearStep, RecordsAreBuildableBuilder.FuelEfficiencyStep, RecordsAreBuildableBuilder { | ||
private String make; | ||
|
||
private int year; | ||
|
||
private double engineSize; | ||
|
||
private boolean isElectric; | ||
|
||
private float fuelEfficiency; | ||
|
||
public DefaultRecordsAreBuildableBuilder() { | ||
} | ||
|
||
public DefaultRecordsAreBuildableBuilder make(String make) { | ||
this.make = make; | ||
return this; | ||
} | ||
|
||
public DefaultRecordsAreBuildableBuilder year(int year) { | ||
this.year = year; | ||
return this; | ||
} | ||
|
||
public DefaultRecordsAreBuildableBuilder engineSize(double engineSize) { | ||
this.engineSize = engineSize; | ||
return this; | ||
} | ||
|
||
public DefaultRecordsAreBuildableBuilder isElectric(boolean isElectric) { | ||
this.isElectric = isElectric; | ||
return this; | ||
} | ||
|
||
public DefaultRecordsAreBuildableBuilder fuelEfficiency(float fuelEfficiency) { | ||
this.fuelEfficiency = fuelEfficiency; | ||
return this; | ||
} | ||
|
||
public RecordsAreBuildable build() { | ||
return new RecordsAreBuildable(make, year, engineSize, isElectric, fuelEfficiency); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
...es/tests/Strategies/StepWise/RecordsAreBuildable/Expected_RecordsAreBuildableBuilder.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package io.jonasg.bob.test; | ||
|
||
import java.lang.String; | ||
|
||
public interface RecordsAreBuildableBuilder { | ||
static RecordsAreBuildableBuilder newBuilder() { | ||
return new DefaultRecordsAreBuildableBuilder(); | ||
} | ||
|
||
YearStep make(String make); | ||
|
||
interface BuildStep { | ||
RecordsAreBuildable build(); | ||
} | ||
|
||
interface FuelEfficiencyStep { | ||
BuildStep fuelEfficiency(float fuelEfficiency); | ||
} | ||
|
||
interface IsElectricStep { | ||
FuelEfficiencyStep isElectric(boolean isElectric); | ||
} | ||
|
||
interface EngineSizeStep { | ||
IsElectricStep engineSize(double engineSize); | ||
} | ||
|
||
interface YearStep { | ||
EngineSizeStep year(int year); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
...src/test/resources/tests/Strategies/StepWise/RecordsAreBuildable/RecordsAreBuildable.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package io.jonasg.bob.test; | ||
|
||
import io.jonasg.bob.Buildable; | ||
import io.jonasg.bob.Strategy; | ||
|
||
import java.lang.String; | ||
|
||
@Buildable(strategy = Strategy.STEP_WISE) | ||
public record RecordsAreBuildable(String make, int year, double engineSize, boolean isElectric, float fuelEfficiency) { | ||
} |
52 changes: 52 additions & 0 deletions
52
...rces/tests/Strategies/Strict/RecordsAreBuildable/Expected_RecordsAreBuildableBuilder.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package io.jonasg.bob.test; | ||
|
||
import io.jonasg.bob.ValidatableField; | ||
import java.lang.Boolean; | ||
import java.lang.Double; | ||
import java.lang.Float; | ||
import java.lang.Integer; | ||
import java.lang.String; | ||
|
||
public final class RecordsAreBuildableBuilder { | ||
private final ValidatableField<String> make = ValidatableField.ofNoneNullableField("make", "RecordsAreBuildable"); | ||
|
||
private final ValidatableField<Integer> year = ValidatableField.ofNoneNullableField("year", "RecordsAreBuildable"); | ||
|
||
private final ValidatableField<Double> engineSize = ValidatableField.ofNoneNullableField("engineSize", "RecordsAreBuildable"); | ||
|
||
private final ValidatableField<Boolean> isElectric = ValidatableField.ofNoneNullableField("isElectric", "RecordsAreBuildable"); | ||
|
||
private final ValidatableField<Float> fuelEfficiency = ValidatableField.ofNoneNullableField("fuelEfficiency", "RecordsAreBuildable"); | ||
|
||
public RecordsAreBuildableBuilder() { | ||
} | ||
|
||
public RecordsAreBuildableBuilder make(String make) { | ||
this.make.set(make); | ||
return this; | ||
} | ||
|
||
public RecordsAreBuildableBuilder year(int year) { | ||
this.year.set(year); | ||
return this; | ||
} | ||
|
||
public RecordsAreBuildableBuilder engineSize(double engineSize) { | ||
this.engineSize.set(engineSize); | ||
return this; | ||
} | ||
|
||
public RecordsAreBuildableBuilder isElectric(boolean isElectric) { | ||
this.isElectric.set(isElectric); | ||
return this; | ||
} | ||
|
||
public RecordsAreBuildableBuilder fuelEfficiency(float fuelEfficiency) { | ||
this.fuelEfficiency.set(fuelEfficiency); | ||
return this; | ||
} | ||
|
||
public RecordsAreBuildable build() { | ||
return new RecordsAreBuildable(make.orElseThrow(), year.orElseThrow(), engineSize.orElseThrow(), isElectric.orElseThrow(), fuelEfficiency.orElseThrow()); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
...r/src/test/resources/tests/Strategies/Strict/RecordsAreBuildable/RecordsAreBuildable.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package io.jonasg.bob.test; | ||
|
||
import io.jonasg.bob.Buildable; | ||
import io.jonasg.bob.Strategy; | ||
|
||
@Buildable(strategy = Strategy.STRICT) | ||
public record RecordsAreBuildable(String make, int year, double engineSize, boolean isElectric, float fuelEfficiency) { | ||
} |