Skip to content

Commit

Permalink
finished describable interface with unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
unknown authored and unknown committed Aug 12, 2012
0 parents commit c41d26f
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
@@ -0,0 +1,4 @@
.classpath
.project
.settings/
target
27 changes: 27 additions & 0 deletions pom.xml
@@ -0,0 +1,27 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.visionarysoftwaresolutions</groupId>
<artifactId>describable</artifactId>
<packaging>jar</packaging>
<version>1.0</version>
<name>Describable</name>
<url>http://www.github.com/leadVisionary/describable</url>
<description>A simple library library for Describable entities, defined as Objects that have a name and a description. </description>
<inceptionYear>August 2012</inceptionYear>
<organization>
<name>Visionary Software Solutions</name>
<url>http://www.visionarysoftwaresolutions.com</url>
</organization>
<scm>
<url>http://www.github.com/leadVisionary/describable</url>
</scm>
<dependencies>
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>0.6-groovy-1.8</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
@@ -0,0 +1,6 @@
package com.visionarysoftwaresolutions.describable;

public interface Describable {
public abstract String getName();
public abstract String getDescription();
}
@@ -0,0 +1,11 @@
package com.visionarysoftwaresolutions.describable

class Book implements Describable {
String name
String description

public Book(String name, String description){
this.name = name
this.description = description
}
}
@@ -0,0 +1,23 @@
package com.visionarysoftwaresolutions.describable

class DescribableSpec extends spock.lang.Specification {
Describable toTest

def setup(){
toTest = new Book("Lord of the Rings", "Awesome!!!")
}

def "get name"(){
when: "I ask for the name of my describable"
def result = toTest.name
then: "the name should be Lord of the Rings"
result == "Lord of the Rings"
}

def "get description"(){
when: "I ask for the description of my describable"
def result = toTest.description
then: "the description should be Awesome!!!"
result == "Awesome!!!"
}
}

0 comments on commit c41d26f

Please sign in to comment.