package org.dontpanic.spanners.api.data;

import org.dontpanic.spanners.api.Application;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;


import static org.dontpanic.spanners.api.stubs.SpannerBuilder.aTestSpanner;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

/**
 * Created by stevie on 04/06/16.
 */
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = Application.class)
public class SpannerRepositoryTest {

    @Autowired SpannerRepository repository;

    @Test
    public void testCreate() {

        // Create the new spanner
        Spanner savedSpanner = aTestSpanner().build();
        savedSpanner = repository.save(savedSpanner);
        assertNotNull(savedSpanner);
        assertNotNull(savedSpanner.getId());

        // Check it's there
        Spanner loadedSpanner = repository.findOne(savedSpanner.getId());
        assertSpannerEquals(savedSpanner, loadedSpanner);
    }

    /**
     * Assert that two spanners are equal:
     * They have same id and all attributes are equal.
     * Both expected and actual spanner objects are non-null.
     */
    public static void assertSpannerEquals(Spanner expected, Spanner actual) {

        assertNotNull("Spanners not equal: expected is null", expected);
        assertNotNull("Spanners not equal: actual is null", actual);

        assertEquals("spanner id", expected.getId(), actual.getId());
        assertEquals("spanner name", expected.getName(), actual.getName());
        assertEquals("spanner owner", expected.getOwner(), actual.getOwner());
        assertEquals("spanner size", expected.getSize(), actual.getSize());
    }

}

@@ -39,55 +39,8 @@
 a;%0A%0A
-import org.dontpanic.spanners.api.Application;%0A
 impo
@@ -195,38 +195,30 @@
 est.
-SpringApplicationConfiguration
+context.SpringBootTest
 ;%0Aim
@@ -264,35 +264,24 @@
 unit4.Spring
-JUnit4Class
 Runner;%0A%0A%0Aim
@@ -450,16 +450,71 @@
 l;%0A%0A/**%0A
+ * Tests for the Spring Boot managed SpannerRepository%0A
  * Creat
@@ -562,19 +562,8 @@
 ring
-JUnit4Class
 Runn
@@ -583,61 +583,16 @@
 ring
-ApplicationConfiguration(classes = Application.class)
+BootTest
 %0Apub
@@ -641,16 +641,24 @@
 towired 
+private 
 SpannerR

Update deprecated spring boot test classes