Skip to content

Commit

Permalink
Fixing codacy issues
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastian-peter committed Jan 5, 2022
1 parent e5980fc commit de64cc8
Showing 1 changed file with 18 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,35 +14,37 @@ import edu.ie3.datamodel.models.value.SValue
import edu.ie3.datamodel.models.value.WeatherValue
import spock.lang.Specification

import static edu.ie3.datamodel.io.csv.timeseries.ColumnScheme.*

class ColumnSchemeTest extends Specification {
def "An unknown column scheme gets not parsed"() {
given:
def invalidColumnScheme = "what's this"

when:
def actual = ColumnScheme.parse(invalidColumnScheme)
def actual = parse(invalidColumnScheme)

then:
!actual.present
}

def "All known column schemes get parsed correctly"() {
when:
def actual = ColumnScheme.parse(input)
def actual = parse(input)

then:
actual.present
actual.get() == expectedColumnScheme

where:
input || expectedColumnScheme
"c" || ColumnScheme.ENERGY_PRICE
"p" || ColumnScheme.ACTIVE_POWER
"pq" || ColumnScheme.APPARENT_POWER
"h" || ColumnScheme.HEAT_DEMAND
"ph" || ColumnScheme.ACTIVE_POWER_AND_HEAT_DEMAND
"pqh" || ColumnScheme.APPARENT_POWER_AND_HEAT_DEMAND
"weather" || ColumnScheme.WEATHER
"c" || ENERGY_PRICE
"p" || ACTIVE_POWER
"pq" || APPARENT_POWER
"h" || HEAT_DEMAND
"ph" || ACTIVE_POWER_AND_HEAT_DEMAND
"pqh" || APPARENT_POWER_AND_HEAT_DEMAND
"weather" || WEATHER
}

def "Correct value classes are returned for all column schemes"() {
Expand All @@ -54,12 +56,12 @@ class ColumnSchemeTest extends Specification {

where:
columnScheme || expectedValueClass
ColumnScheme.ENERGY_PRICE || EnergyPriceValue
ColumnScheme.ACTIVE_POWER || PValue
ColumnScheme.APPARENT_POWER || SValue
ColumnScheme.HEAT_DEMAND || HeatDemandValue
ColumnScheme.ACTIVE_POWER_AND_HEAT_DEMAND || HeatAndPValue
ColumnScheme.APPARENT_POWER_AND_HEAT_DEMAND || HeatAndSValue
ColumnScheme.WEATHER || WeatherValue
ENERGY_PRICE || EnergyPriceValue
ACTIVE_POWER || PValue
APPARENT_POWER || SValue
HEAT_DEMAND || HeatDemandValue
ACTIVE_POWER_AND_HEAT_DEMAND || HeatAndPValue
APPARENT_POWER_AND_HEAT_DEMAND || HeatAndSValue
WEATHER || WeatherValue
}
}

0 comments on commit de64cc8

Please sign in to comment.