Пример #1
0
 @Test(expected = IllegalArgumentException.class)
 public void testFetchWrongProp() {
   EnumWeatherProperty[] ps = new EnumWeatherProperty[1];
   ps[0] = new EnumWeatherProperty("ocean.temp", Float.class);
   ps[0].put("test", 20.5f);
   WeatherController wc = create("test", ps);
   wc.getInt("ocean.temp");
 }
Пример #2
0
 @Test
 public void testFetchProp() {
   EnumWeatherProperty[] ps = new EnumWeatherProperty[2];
   ps[0] = new EnumWeatherProperty("ocean.temp", Float.class);
   ps[0].put("test", 20.5f);
   ps[1] = new EnumWeatherProperty("wind", Vector3f.class);
   ps[1].put("test", new Vector3f(1, 0, 0));
   WeatherController wc = create("test", ps);
   assertTrue(20.5f == wc.getFloat("ocean.temp"));
   assertTrue(wc.getVec3("wind").distance(new Vector3f(1, 0, 0)) < weakEps);
 }
Пример #3
0
 @Test
 public void testFetchMissingProp() {
   WeatherController wc = create("test", new WeatherProperty[0]);
   assertNull(wc.getFloat("foo"));
 }